public async Task <IActionResult> Index() { IActionResult result = null; try { var capsule = await _capsuleService.GetCapsuleByUserAsync(); if (capsule != null && !capsule.AnyMessage()) { ModelState.AddModelError("Capsule", "Sorry, your capsule is empty!"); } result = View( viewName: nameof(Index), model: new Delivery(capsule) ); } catch (Exception) // (BrokenCircuitException) { // Catch error when API is in circuit-opened mode //HandleBrokenCircuitException(); } return(result); }
public async Task <ViewResult> Index(string returnUrl) { ViewResult result = View(); try { result = View( new CapsuleIndexViewModel { Capsule = await _capsuleService.GetCapsuleByUserAsync(), ReturnUrl = returnUrl } ); } catch (Exception) // (BrokenCircuitException) { // Catch error when API is in circuit-opened mode //HandleBrokenCircuitException(); } return(result); }