-
-
Save dcomartin/69032915466eab900bd58aa7824772d2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class OrderController : Controller | |
{ | |
private readonly IMediator _mediator; | |
public OrderController(IMediator mediator) | |
{ | |
_mediator = mediator; | |
} | |
public async Task<IActionResult> Detail(int orderId) | |
{ | |
try | |
{ | |
var viewModel = await _mediator.Send(new GetOrderQuery(orderId)); | |
return View(viewModel); | |
} | |
catch (OrderNotFoundException ex) | |
{ | |
return NotFound($"Order ({ex.OrderId}) not found."); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment