Answer the question
In order to leave comments, you need to log in
How to solve JSON handling issue in ASP Net MVC 5?
The bottom line is that after the method works, I have:
public JsonResult JsonShowProducts(string emailCart)
{
Cart cart = repository.GetCart(emailCart);
return Json(productFunc.ToProductResults(cart.Products), JsonRequestBehavior.AllowGet);
}
outputs [{"Sum":780,"Brand":"Versace","Category":"T-shirts"},{"Sum":650,"Brand":"Calvin clain","Category":"T-shirts" },{"Sum":3100,"Brand":"J.Crew.","Category":"Pants"}] under the link " localhost:49827/Admin/JsonShowProducts " and should display in the view " localhost:49827 /Admin/Index ".
Here is the code from the Index client side:
@{
ViewBag.Title = "Index";
}
Administrator
@if (ViewBag.CountCarts > 0)
{
List of buyers
Surname | Name | The address | ||
---|---|---|---|---|
@el.LastName | @el.Name | @el.HomeAddress | using (Ajax.BeginForm("JsonShowProducts", new AjaxOptions { OnSuccess = "OnSuccess" })) { } | using (Html.BeginForm("Agree", "Admin", FormMethod.Post)) { } |
Brand | Category | Colour | Price | |
---|---|---|---|---|
@el.Brand | @el.Category | @el.Color | @el.Sum | @if (!el.IsRemoved) { using (Html.BeginForm("DeleteProduct", "Admin", FormMethod.Post)) { } } else { using (Html.BeginForm("ReturnProduct", "Admin", FormMethod.Post )) { } } |
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question