Created
July 15, 2019 08:02
-
-
Save ducmeit1/24dc680bb4eae168837001762172f1c8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 UsersController : ControllerBase | |
{ | |
private readonly IMediator _mediator; | |
public UsersController(IMediator mediator) { | |
_mediator = mediator ?? throw new ArgumentNullException(nameof(mediator)); | |
} | |
[HttpGet("{id}")] | |
public async Task<Order> Get(int id) { | |
var user = await _mediator.Send(new GetUserDetailQuery(id)); | |
if user == null { | |
return NotFound(); | |
} | |
return Ok(user); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment