public IViewComponentResult Invoke(string view = "Default") { if (view == "Small") { var totalValue = _getCart.Action().Sum(x => x.Value * x.Qty); return(View(view, $"${totalValue}")); } return(View(view, _getCart.Action())); }
public IActionResult OnGet([FromServices] GetCart getCart) { CartList = getCart.Action(); return(Page()); }
public IActionResult GetCartMain([FromServices] GetCart getCart) { var cart = getCart.Action(); return(PartialView("_CartPartial", cart)); }
public IActionResult GetCartNav([FromServices] GetCart getCart) { var totalValue = getCart.Action().Sum(x => x.Value * x.Qty); return(PartialView("Components/Cart/Small", $"${totalValue}")); }