public JsonResult UpdateCart(string productID, int quantity) { WCFCart_OrderClient coClient = new WCFCart_OrderClient(); try { if (quantity > 0) { //get cart product Cart_Product cpToUpdate = coClient.GetCartProduct(@User.Identity.Name, new Guid(productID)); //change the quantity cpToUpdate.Quantity = quantity; //update coClient.UpdateCart(cpToUpdate); //refresh the list List<Cart_Product> cp = coClient.GetCart(@User.Identity.Name).ToList(); //return PartialView("_Cart", cp); return Json("success"); } else { return Json("error"); } } catch (Exception e) { return Json("error"); } }
public ActionResult UpdateCart(string productID, int quantity) { WCFCart_OrderClient coClient = new WCFCart_OrderClient(); //get cart product Cart_Product cpToUpdate = coClient.GetCartProduct(@User.Identity.Name, new Guid(productID)); //change the quantity cpToUpdate.Quantity = quantity; //update coClient.UpdateCart(cpToUpdate); //refresh the list List<Cart_Product> cp = coClient.GetCart(@User.Identity.Name).ToList(); //return PartialView("_Cart", cp); return Json(cp); }