public async Task <IActionResult> OnPostCheckOutAsync()
        {
            Cart = await _cartRepository.GetCartByUserName("test");

            if (!ModelState.IsValid)
            {
                return(Page());
            }

            Order.UserName   = "******";
            Order.TotalPrice = Cart.TotalPrice;

            await _orderRepository.CheckOut(Order);

            await _cartRepository.ClearCart("test");

            return(RedirectToPage("Confirmation", "OrderSubmitted"));
        }
Esempio n. 2
0
        public async Task <IActionResult> OnGetAsync()
        {
            Cart = await _cartRepository.GetCartByUserName("test");

            return(Page());
        }