public async Task <ActionResult <Author> > PostAuthor([FromBody] Author author) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var createdAuthor = await authorsService.CreateAuthorAsync(author); return(Created($"/api/authors/{createdAuthor.Id}", createdAuthor)); }
public async Task <IActionResult> Post([FromBody] AuthorDTO author) { await service.CreateAuthorAsync(author); return(Ok()); }