Created
December 29, 2019 05:13
-
-
Save hadoan/3521e5505fe2ade92d3ce2f0abaec683 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 TodoCommandController : ControllerBase | |
{ | |
private readonly IMediator _mediator; | |
public TodoCommandController(IMediator mediator) | |
{ | |
_mediator = mediator; | |
} | |
[HttpPost] | |
public async Task<ActionResult<Guid>> AddTodo(string name) | |
{ | |
return await _mediator.Send<Guid>(new AddTodoCommand { Name = name }); | |
} | |
[HttpPost] | |
public async Task<ActionResult<bool>> CompleteTodo(Guid id) | |
{ | |
return await _mediator.Send<bool>(new CompleteTodoCommand { Id = id }); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment