public TestItemType Patch([FromODataUri] int key, Delta <TestItemType> patch) { TestItemType testitemtype = db.TestItemTypes.Find(key); patch.Patch(testitemtype); db.SaveChanges(); return(testitemtype); }
// PUT api/TestItemTypes/5 public HttpResponseMessage PutTestItemType(int id, TestItemType testitemtype) { if (ModelState.IsValid && id == testitemtype.Id) { db.Entry(testitemtype).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { return(Request.CreateResponse(HttpStatusCode.NotFound)); } return(Request.CreateResponse(HttpStatusCode.OK)); } else { return(Request.CreateResponse(HttpStatusCode.BadRequest)); } }
public Article Post(Article item) { db.Articles.Add(item); db.SaveChanges(); return(item); }