Skip to content

Commit

Permalink
Simplify controller example
Browse files Browse the repository at this point in the history
  • Loading branch information
bruno-garcia committed Nov 26, 2017
1 parent c322252 commit 46d3712
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,12 @@ public void Configure(IApplicationBuilder app)
public class SomeMessageController
{
private readonly IMessagePublisher _publisher;
public SomeMessageController(IMessagePublisher publisher) => _publisher;
public SomeMessageController(IMessagePublisher publisher)
=> _publisher = publisher;

[HttpPut]
public async Task<IActionResult> PublishSomeMessage([FromBody] SomeMessage message, CancellationToken token)
{
await _publisher.Publish(message, token);
return Accepted();
}
public Task PublishSomeMessage([FromBody] SomeMessage message, CancellationToken token)
=> _publisher.Publish(message, token);
}
```

Expand Down

0 comments on commit 46d3712

Please sign in to comment.