public async Task <IActionResult> OnPostAsync() { Delivery delivery; Payment payment; if (Delivery == "delivery1") { delivery = Models.Delivery.Fast; } else if (Delivery == "delivery2") { delivery = Models.Delivery.Cheap; } else { delivery = Models.Delivery.Free; } if (Payment == "payment1") { payment = Models.Payment.Card; } else { payment = Models.Payment.Paypal; } ApplicationUser = await UserManager.GetUserAsync(User); ShoppingCart shoppingCart = new ShoppingCart(ApplicationUser.GetItems(), DataAcces); Order order = new Order( ApplicationUser.Id, shoppingCart, delivery, payment, ApplicationUser.UserName, ApplicationUser.Email, ApplicationUser.PhoneNumber, ApplicationUser.FirstName, ApplicationUser.SecondName, ApplicationUser.AddressStreet, ApplicationUser.AddressHouseNumber, ApplicationUser.AddressCity, ApplicationUser.AddressCountry, ApplicationUser.AddressZip); ApplicationUser.Items = ""; await UserManager.UpdateAsync(ApplicationUser); DataAcces.AddOrder(order); return(RedirectToPage("OrderSummary")); }