Skip to content

Instantly share code, notes, and snippets.

@ntakouris
Created July 20, 2019 16:19
Show Gist options
  • Save ntakouris/ae7cf35acbaac07ad70676eaa82d5602 to your computer and use it in GitHub Desktop.
Save ntakouris/ae7cf35acbaac07ad70676eaa82d5602 to your computer and use it in GitHub Desktop.
private readonly IPostService _postService;
public PostsController(IPostService postService) {
_postService = postService;
}
[HttpGet(ApiRoutes.Posts.Get)]
public IActionResult Get([FromRoute] Guid postId)
{
var post = _postService.GetPostById(postId);
if (post == null)
return NotFound();
return Ok(post);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment