Пример #1
0
        // POST: odata/T_GPBZ
        public IHttpActionResult Post(T_GPBZ T_GPBZ)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.T_GPBZ.Add(T_GPBZ);
            db.SaveChanges();

            return(Created(T_GPBZ));
        }
Пример #2
0
        // DELETE: odata/T_GPBZ(5)
        public IHttpActionResult Delete([FromODataUri] decimal key)
        {
            T_GPBZ T_GPBZ = db.T_GPBZ.Find(key);

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

            db.T_GPBZ.Remove(T_GPBZ);
            db.SaveChanges();

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #3
0
        public IHttpActionResult Patch([FromODataUri] decimal key, Delta <T_GPBZ> patch)
        {
            Validate(patch.GetEntity());

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

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

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

            patch.Patch(T_GPBZ);

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

            return(Updated(T_GPBZ));
        }