Skip to content

Instantly share code, notes, and snippets.

@httpmurilo
Created May 7, 2020 02:38
Show Gist options
  • Save httpmurilo/36ecfdf42e1c455d72b679de7ad21237 to your computer and use it in GitHub Desktop.
Save httpmurilo/36ecfdf42e1c455d72b679de7ad21237 to your computer and use it in GitHub Desktop.
Post2
[HttpPost]
public IActionResult AdicionarAutor(Autor autor)
{
if(autor == null)
{
return BadRequest("Autor não foi informado no body da request");
}
_context.Add(autor);
_context.SaveChanges();
return Created($"api/autor/id",new {autor = autor});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment