Delete a post

This commit is contained in:
Robert Marshall 2020-04-10 13:16:44 +01:00
parent d2080679fd
commit 0d29e9494a
2 changed files with 15 additions and 2 deletions

View file

@ -100,7 +100,10 @@ namespace Robware.Api.Blog.Controllers {
[HttpGet(nameof(GetAllPosts))]
public async Task<ActionResult<BlogPost[]>> GetAllPosts() => (await _blogRepository.GetAllPostsAsync()).ToArray();
//[HttpGet]
//Task DeletePost(int id);
[HttpPost(nameof(DeletePost))]
public async Task<ActionResult> DeletePost([FromBody] int id) {
await _blogRepository.DeletePostAsync(id);
return Ok();
}
}
}