public ActionResult ListCartItem() { if (Session["cart"] != null) { MyCart myCart = Session["cart"] as MyCart; ListCartsViewModel model = new ListCartsViewModel { CartItems = myCart.ListCart, TotalPrice = myCart.TotalPrice }; return(View(model)); } return(RedirectToAction("ListProductsForOrder")); }
public ActionResult ListMyCarts() { CartManager cartManager; if (Session["cart"] != null) { cartManager = Session["cart"] as CartManager; } else { cartManager = new CartManager(); } ListCartsViewModel model = new ListCartsViewModel { Carts = cartManager.Carts, TotalPrice = cartManager.TotalPrice }; return(View(model)); }