コード例 #1
0
ファイル: CheckOut.cshtml.cs プロジェクト: shishir28/eDukaan
        public async Task <IActionResult> OnPostCheckOutAsync()
        {
            var userName = "******";

            Cart = await _basketService.GetBasket(userName);

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

            Order.UserName   = userName;
            Order.TotalPrice = Cart.TotalPrice;

            await _basketService.CheckoutBasket(Order);

            return(RedirectToPage("Confirmation", "OrderSubmitted"));
        }
コード例 #2
0
        public async Task <IActionResult> CheckoutBasket([FromBody] BasketItemRequest basketItemRequest)
        {
            var apiUser = BuildApiUser();

            if (apiUser == null)
            {
                return(Unauthorized("Invalid or no X_API_SECRET"));
            }

            try
            {
                await _basketService.CheckoutBasket(apiUser.CustomerKey);
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }


            return(Ok("Item has been checkout"));
        }