Beispiel #1
0
        public async Task <IActionResult> OnPostCheckOutAsync()
        {
            Cart = await _basketApi.GetCart("test");

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

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

            await _orderApi.Checkout(Order);

            await _basketApi.DeleteCart(Cart.Username);

            return(RedirectToPage("Confirmation", "OrderSubmitted"));
        }
Beispiel #2
0
        public async Task <IActionResult> OnPostCheckOutAsync()
        {
            username = HttpContext.Session.GetString("username");
            Cart     = await _basketApi.GetCart(username);

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

            Order.UserName   = username;
            Order.TotalPrice = Cart.TotalPrice;

            await _orderApi.Checkout(Order);

            await _basketApi.DeleteCart(Order.UserName);

            return(RedirectToPage("Confirmation", "OrderSubmitted"));
        }