示例#1
0
        public async Task <IActionResult> SendCapsule(Delivery delivery)
        {
            IActionResult result = null;

            try
            {
                if (ModelState.IsValid)
                {
                    delivery.Capsule = await _capsuleService.GetCapsuleByUserAsync();

                    await _deliveryService.DeliverCapsuleAsync(delivery);

                    result = RedirectToAction(
                        controllerName: "Delivery",
                        actionName: nameof(Success)
                        );
                }
                else
                {
                    result = View(
                        viewName: nameof(Index),
                        model: delivery
                        );
                }
            }
            catch (Exception) // (BrokenCircuitException)
            {
                // Catch error when API is in circuit-opened mode
                //HandleBrokenCircuitException();
            }

            return(result);
        }