public IHttpActionResult PutTask(int id, string postedDate, Task task) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != task.TaskID || postedDate != task.PostedDate) { return(BadRequest()); } db.Entry(task).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!TaskExists(id, postedDate)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }