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