public ActionResult Index(ShoppingCartViewModel model) { if (ModelState.IsValid) { return RedirectToAction("Finish"); } return View(model); }
private ShoppingCartViewModel GetCart() { ShoppingCartViewModel cart = (ShoppingCartViewModel)Session[CartSessionKey]; if (cart == null) { cart = new ShoppingCartViewModel(); Session[CartSessionKey] = cart; } return cart; }
private void CleanCart() { Session[CartSessionKey] = new ShoppingCartViewModel(); }
private ActionResult GetCartJson(ShoppingCartViewModel cart) { return Json(new { ProductIds = cart.Items.Select(item => item.Product.Id) }); }