Skip to content

Instantly share code, notes, and snippets.

@ksummerlin
Created July 3, 2014 04:42
Show Gist options
  • Save ksummerlin/5031e8ed334303e4bcee to your computer and use it in GitHub Desktop.
Save ksummerlin/5031e8ed334303e4bcee to your computer and use it in GitHub Desktop.
[AcceptVerbs("PATCH")]
public HttpResponseMessage PatchOrder(int id, Delta<Order> deltaOrder)
{
using (DBOrderEntities objContext = new DBOrderEntities()) {
var order = objContext.Orders.SingleOrDefault(o => o.ID == id);
if (order == null)
{
throw new HttpResponseException(HttpStatusCode.NotFound);
}
deltaOrder.Patch(order);
objContext.SaveChanges();
}
return Request.CreateResponse(HttpStatusCode.NoContent);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment