public IActionResult Index() { //retrieve shopping cart items then update current items var items = _shoppingCart.GetShoppingCartItems(); _shoppingCart.ShoppingCartItems = items; var shoppingCartViewModel = new ShoppingCartViewModel { ShoppingCart = _shoppingCart, ShoppingCartTotal = _shoppingCart.GetShoppingCartTotal(), }; return(View(shoppingCartViewModel)); }
public ViewResult Index() { //var items = _shoppingCart.GetShoppingCartItems(); var items = new List <ShoppingCartItem> { new ShoppingCartItem(), new ShoppingCartItem() }; _shoppingCart.ShoppingCartItems = items; var shoppingCartViewModel = new ShoppingCartViewModel { ShoppingCart = _shoppingCart, ShoppingCartTotal = _shoppingCart.GetShoppingCartTotal() }; return(View(shoppingCartViewModel)); }