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