コード例 #1
0
        // POST: odata/KJDW_TEST
        public IHttpActionResult Post(KJDW_TEST KJDW_TEST)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.KJDW_TEST.Add(KJDW_TEST);
            db.SaveChanges();

            return(Created(KJDW_TEST));
        }
コード例 #2
0
        // DELETE: odata/KJDW_TEST(5)
        public IHttpActionResult Delete([FromODataUri] decimal key)
        {
            KJDW_TEST KJDW_TEST = db.KJDW_TEST.Find(key);

            if (KJDW_TEST == null)
            {
                return(NotFound());
            }

            db.KJDW_TEST.Remove(KJDW_TEST);
            db.SaveChanges();

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #3
0
        public IHttpActionResult Patch([FromODataUri] decimal key, Delta <KJDW_TEST> patch)
        {
            Validate(patch.GetEntity());

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            KJDW_TEST KJDW_TEST = db.KJDW_TEST.Find(key);

            if (KJDW_TEST == null)
            {
                return(NotFound());
            }

            patch.Patch(KJDW_TEST);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!KJDW_TESTExists(key))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(Updated(KJDW_TEST));
        }