Exemple #1
0
 /*PUT api/<controller>/5  This Put() will update a
  * task  taking argument id and value, and return an
  * error if it is not found in the database.
  */
 public HttpResponseMessage Put(int id, [FromBody] UserTask value)
 {
     if (!ModelState.IsValid)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
     }
     else
     {
         var foundUserTaskForUpdate = Repo.GetUserTaskById(id);
         Repo.UpdateUserTaskById(id, value);
         return(Request.CreateResponse(HttpStatusCode.Created));
     }
 }