Example #1
0
        // POST: odata/T_SLGPBZ
        public IHttpActionResult Post(T_SLGPBZ T_SLGPBZ)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.T_SLGPBZ.Add(T_SLGPBZ);
            db.SaveChanges();

            return(Created(T_SLGPBZ));
        }
Example #2
0
        // DELETE: odata/T_SLGPBZ(5)
        public IHttpActionResult Delete([FromODataUri] decimal key)
        {
            T_SLGPBZ T_SLGPBZ = db.T_SLGPBZ.Find(key);

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

            db.T_SLGPBZ.Remove(T_SLGPBZ);
            db.SaveChanges();

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

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

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

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

            patch.Patch(T_SLGPBZ);

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

            return(Updated(T_SLGPBZ));
        }