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())); }
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()))); }