示例#1
0
        public IActionResult Index()
        {
            var products = this.HttpContext.Session.Get <List <Product> >("cart");

            if (products == null)
            {
                products = new List <Product>();
            }

            this.ViewData["ProductsCount"] = products.Count;

            this.TotalPrice             = products.Select(x => x.Price).Sum();
            this.ViewData["TotalPrice"] = this.TotalPrice;

            return(View(cartProductService.ConvertForShoppingCart(products)));
        }