示例#1
0
 public HttpResponseMessage Patch(PatchModel<Todo> todoPatch)
 {
     // You first have to fetch the model from the database.
     // DbContext makes partial database updates trivial !
     // But you always first need to fetch the data from the database...
     Todo updateModel = _db.Todoes.Find( todoPatch.GetKeys(_db));
     // now you can apply the received updates on our fetched model
     todoPatch.UpdateModel(updateModel);
     // and save the changes
     _db.SaveChanges();
     // http status code 204 marks the request as excecuted
     return new HttpResponseMessage<Todo>(HttpStatusCode.NoContent);
 }