// // GET: /ShoppingCart/ public ActionResult Index() { var cart = ShoppingCart.GetCart(this.HttpContext); var viewModel = new ShoppingCartViewModel { CartItems = cart.GetCartItems(), CartTotal = cart.GetTotal() }; return View(viewModel); }
// // GET: /ShoppingCart/ public async Task<IActionResult> Index() { var cart = ShoppingCart.GetCart(DbContext, HttpContext); // Set up our ViewModel var viewModel = new ShoppingCartViewModel { CartItems = await cart.GetCartItems(), CartTotal = await cart.GetTotal() }; // Return the view return View(viewModel); }
// // GET: /ShoppingCart/ public IActionResult Index() { var cart = ShoppingCart.GetCart(db, this.Context); // Set up our ViewModel var viewModel = new ShoppingCartViewModel { CartItems = cart.GetCartItems(), CartTotal = cart.GetTotal() }; // Return the view return View(viewModel); }