コード例 #1
0
        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));
        }
コード例 #2
0
        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));
        }