コード例 #1
0
        private async Task OrderNowAsync(IDialogContext context)
        {
            var authUser = await identityService.GetAuthUserAsync(context);

            var basket = orderingService.MapOrderToBasket(order);
            await basketService.Checkout(basket, authUser.AccessToken);
        }
コード例 #2
0
        public async Task <IActionResult> Checkout(Order model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var user   = _appUserParser.Parse(HttpContext.User);
                    var basket = _orderSvc.MapOrderToBasket(model);

                    await _basketSvc.Checkout(basket);

                    //Redirect to historic list.
                    return(RedirectToAction("Index"));
                }
            }
            catch (BrokenCircuitException)
            {
                ModelState.AddModelError("Error", "It was not possible to create a new order, please try later on. (Business Msg Due to Circuit-Breaker)");
            }
            return(View(model));
        }
コード例 #3
0
        public async Task <IActionResult> Checkout(Order model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var user   = _appUserParser.Parse(HttpContext.User);
                    var basket = _orderSvc.MapOrderToBasket(model);
                    await _basketSvc.Checkout(basket);

                    //Redirect to historic list.
                    return(RedirectToAction("Index"));
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("Error", $"It was not possible to create a new order, please try later on ({ex.GetType().Name} - {ex.Message})");
            }

            return(View("Create", model));
        }