public IActionResult GetById(string id) { var item = TodoItems.Find(id); if (item == null) return HttpNotFound(); return new ObjectResult(item); }
public IActionResult Delete(string id) { var todo = TodoItems.Find(id); if (todo == null) { return(HttpNotFound()); } TodoItems.Remove(id); return(new NoContentResult()); }
public IActionResult Update(string id, [FromBody] TodoItem item) { if (item == null || item.Key != id) { return(HttpBadRequest()); } var todo = TodoItems.Find(id); if (todo == null) { return(HttpNotFound()); } TodoItems.Update(item); return(new NoContentResult()); }