public TestItemType Patch([FromODataUri] int key, Delta <TestItemType> patch)
        {
            TestItemType testitemtype = db.TestItemTypes.Find(key);

            patch.Patch(testitemtype);

            db.SaveChanges();

            return(testitemtype);
        }
예제 #2
0
        // 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));
            }
        }
예제 #3
0
 public Article Post(Article item)
 {
     db.Articles.Add(item);
     db.SaveChanges();
     return(item);
 }