public IViewComponentResult Invoke(string view = "Default") { if (view == "Small") { var totalValue = _getCart.Exec().Sum(x => x.RealValue * x.Quantity); return(View(view, $"${totalValue}")); } return(View(view, _getCart.Exec())); }
public IActionResult OnGet([FromServices] GetCart getCart, [FromServices] GetCustomerInformation getCustomerInformation) { var cart = getCart.Exec(); if (cart.Count() == 0) { return(RedirectToPage("/Cart")); } var information = getCustomerInformation.Exec(); if (information == null) { if (_environment.IsDevelopment()) { CustomerInformation = new CustomerInformationDto { FirstName = "Toko", LastName = "Goshadze", Email = "*****@*****.**", PhoneNumber = "599744894", Address = "28 Amaghleba street", City = "Tbilisi", PostCode = "0105" } } ; return(Page()); } return(RedirectToPage("/Checkout/Payment")); }
public IActionResult OnGet([FromServices] GetCustomerInformation getCustomerInformation, [FromServices] GetCart getCart) { var information = getCustomerInformation.Exec(); var totalValue = getCart.Exec().Sum(x => x.RealValue * x.Quantity); TotalValue = $"${totalValue}"; if (information == null) { return(RedirectToPage("/Checkout/CustomerInformation")); } var cart = getCart.Exec(); if (cart.Count() == 0) { return(RedirectToPage("/Cart")); } return(Page()); }
public IActionResult GetCartMain([FromServices] GetCart getCart) { var cart = getCart.Exec(); return(PartialView("_CartPartial", cart)); }
public IActionResult GetCartComponent([FromServices] GetCart getCart) { var totalValue = getCart.Exec().Sum(x => x.RealValue * x.Quantity); return(PartialView("Components/Cart/Small", $"${totalValue}")); }
public IActionResult OnGet([FromServices] GetCart getCart) { Cart = getCart.Exec(); return(Page()); }