public IHttpActionResult PutTodo(int id, Todo Todo) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != Todo.Id) { return(BadRequest()); } db.Update(Todo, Todo.Id); try { db.Save(); } catch (DbUpdateConcurrencyException) { if (!TodoExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }