Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Created May 3, 2017 15:08
Show Gist options
  • Save dcomartin/f8ceb58044163075165adcd2bec56e8d to your computer and use it in GitHub Desktop.
Save dcomartin/f8ceb58044163075165adcd2bec56e8d to your computer and use it in GitHub Desktop.
[HttpPost]
public IActionResult Create([FromBody] TodoItem item)
{
if (item == null)
{
return BadRequest();
}
_todoRepository.Add(item);
return CreatedAtRoute("GetTodo", new { id = item.Key }, item);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment