Created
August 6, 2014 16:01
-
-
Save pedroreys/63e116256ec7cfad5910 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
[RoutePrefix("api/assemble/wip")] | |
public class AssembleWipItemController : ApiController | |
{ | |
private readonly IMediator _mediator; | |
public AssembleWipItemController(IMediator mediator) | |
{ | |
_mediator = mediator; | |
} | |
[Route("")] | |
public WipItemResult Get([FromUri] GetModel input) | |
{ | |
return _mediator.Send(input); | |
} | |
[Route("{wipId}")] | |
public WipItemRepresentationModel GetById([FromUri] GetModelById input) | |
{ | |
return _mediator.Send(input); | |
} | |
[Route("{wipId}/start")] | |
[HttpPost] | |
public StartWipResult Start([FromUri]StartWipModel input) | |
{ | |
return _mediator.Send(input); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Controller actions are a simple call to MediatR to dispatch the request to a handler that can be tested isolated from Web API.
We also use FluentValidation to validate the input models with Validators that also can be tested isolated from Web API