示例#1
0
        public async Task <IViewComponentResult> InvokeAsync()
        {
            var cartUid = HttpContext.Session.GetCartId();

            if (cartUid == string.Empty)
            {
                return(Content("0"));
            }

            var result = await _client.UpdateCart(cartUid);

            return(Content(result.Products.Select(a => a.CountItem).Sum().ToString()));
        }
示例#2
0
        public async Task <IActionResult> ViewCart()
        {
            var cartUid = HttpContext.Session.GetCartId();

            return(string.IsNullOrEmpty(cartUid) ? View(null) : View(await _client.UpdateCart(cartUid, currency: HttpContext.Session.GetCurrency())));
        }