public ActionResult SaveOrder(CheckoutCartModel checkoutCart) { if (ModelState.IsValid) { foreach (CartItemModel cartItem in checkoutCart.CartItems) { if (!UpdateCart(cartItem)) { return RedirectToAction("WrongQty", new { prodId = cartItem.ProductID, qty = cartItem.Quantity }); } } } return RedirectToAction("ThankYou"); }
public ActionResult ViewCart() { SessionHelper sessionHlp = new SessionHelper(); Dictionary<int, int> sessionCart = sessionHlp.GetCart(); A00964856_ShoppingCartEntities db = new A00964856_ShoppingCartEntities(); ProductRepo prodRepo = new ProductRepo(db); CartItemRepo cartItemRepo = new CartItemRepo(prodRepo); List<CartItemModel> cartItems = cartItemRepo.GetAllCartItems(sessionCart); CheckoutCartModel checkoutCart = new CheckoutCartModel(); checkoutCart.CartItems = cartItems; return View(checkoutCart); }