예제 #1
0
        // POST: odata/Lkup_UOI
        public IHttpActionResult Post(Lkup_UOI lkup_UOI)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Lkup_UOI.Add(lkup_UOI);
            db.SaveChanges();

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

            lkup_UOI.ACTIVE = "N";
            if (lkup_UOI == null)
            {
                return(NotFound());
            }

            db.Entry(lkup_UOI).State = EntityState.Modified;
            //db.Lkup_UOI.Remove(lkup_UOI);
            db.SaveChanges();

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #3
0
        // PUT: odata/Lkup_UOI(5)
        public IHttpActionResult Put([FromODataUri] decimal key, Delta <Lkup_UOI> patch)
        {
            Validate(patch.GetEntity());

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

            Lkup_UOI lkup_UOI = db.Lkup_UOI.Find(key);

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

            patch.Put(lkup_UOI);

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

            return(Updated(lkup_UOI));
        }