public async Task <IActionResult> OnPostCheckOutAsync() { /* username = HttpContext.Session.GetString("username");*/ Cart = await _basketApi.GetCart("test"); if (!ModelState.IsValid) { return(Page()); } Order.UserName = "******"; Order.TotalPrice = Cart.TotalPrice; await _orderApi.Checkout(Order); await _basketApi.DeleteCart(Order.UserName); return(RedirectToPage("Confirmation", "OrderSubmitted")); }
public async Task <IActionResult> OnPostCheckOutAsync() { User = await _userApi.GetUserById(Guid.Parse(HttpContext.Session.GetString("userId"))); Cart = await _basketApi.GetBasket(User.Id.ToString()); if (!ModelState.IsValid) { return(Page()); } Order.Username = User.Id.ToString(); Order.TotalPrice = Cart.TotalPrice; await _orderApi.Checkout(Order); // await _basketApi.DeleteCart(Order.Username); return(RedirectToPage("Confirmation", "OrderSubmitted")); }