Пример #1
0
        public IHttpActionResult PutSUPPLIER(string id, SUPPLIER sUPPLIER)
        {
            //if (!ModelState.IsValid)
            //{
            //    return BadRequest(ModelState);
            //}

            if (id != sUPPLIER.SUPLNO)
            {
                return(BadRequest());
            }


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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #2
0
        public IHttpActionResult PutItem(string id, Item item)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != item.itcode)
            {
                return(BadRequest());
            }

            db.Entry(item).State = EntityState.Modified;

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #3
0
        public IHttpActionResult PutSupplier(string id, Supplier supplier)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != supplier.SuplNo)
            {
                return(BadRequest());
            }

            db.Entry(supplier).State = EntityState.Modified;

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #4
0
        public IHttpActionResult PostPOMASTER(POMASTER pOMASTER)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.POMASTERs.Add(pOMASTER);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (POMASTERExists(pOMASTER.PONO))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = pOMASTER.PONO }, pOMASTER));
        }
Пример #5
0
        public IHttpActionResult PutPODETAIL(string id, PODETAIL pODETAIL)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != pODETAIL.PONO.Trim())
            {
                return(BadRequest());
            }

            db.Entry(pODETAIL).State = EntityState.Modified;

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #6
0
        public IHttpActionResult PutPodetail(string id, Podetail podetail)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != podetail.pono)
            {
                return(BadRequest());
            }

            db.Entry(podetail).State = EntityState.Modified;

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #7
0
        public IHttpActionResult Post(SUPPLIER obj)
        {
            db.SUPPLIERs.Add(obj);
            int NoOfRowsAffected = db.SaveChanges();

            if (NoOfRowsAffected > 0)
            {
                return(StatusCode(HttpStatusCode.Created));
            }
            {
                return(BadRequest("Failed to add supplier"));
            }
        }
Пример #8
0
        public string CreateItem(ItemModel item)
        {
            var dbItem = new ITEM
            {
                ITCODE = item.Code,
                ITDESC = item.Desc,
                ITRATE = item.Rate
            };

            dbContext.ITEM.Add(dbItem);
            dbContext.SaveChanges();
            return(dbItem.ITCODE);
        }
Пример #9
0
 public void Delete(String SUPLNO)
 {
     using (PODbEntities db = new PODbEntities())
     {
         db.SUPPLIERs.Remove(db.SUPPLIERs.Find(SUPLNO));
         db.SaveChanges();
     }
 }
Пример #10
0
 public void Put([FromBody] SUPPLIER item)
 {
     using (PODbEntities db = new PODbEntities())
     {
         db.Entry(item).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
     }
 }
Пример #11
0
 public void Post([FromBody] SUPPLIER item)
 {
     using (PODbEntities db = new PODbEntities())
     {
         db.SUPPLIERs.Add(item);
         db.SaveChanges();
     }
 }
 public void Delete(String PONO)
 {
     using (PODbEntities db = new PODbEntities())
     {
         db.PODETAILs.Remove(db.PODETAILs.SingleOrDefault(m => m.PONO == PONO));
         db.SaveChanges();
     }
 }
 public void Post([FromBody] PODETAIL item)
 {
     using (PODbEntities db = new PODbEntities())
     {
         db.PODETAILs.Add(item);
         db.SaveChanges();
     }
 }
 public void Delete(String PONO)
 {
     using (PODbEntities db = new PODbEntities())
     {
         db.POMASTERs.Remove(db.POMASTERs.Find(PONO));
         db.SaveChanges();
     }
 }
 public void Delete(String ITCODE)
 {
     using (PODbEntities db = new PODbEntities())
     {
         db.ITEMs.Remove(db.ITEMs.Find(ITCODE));
         db.SaveChanges();
     }
 }
 public void Post([FromBody] ITEM item)
 {
     using (PODbEntities db = new PODbEntities())
     {
         db.ITEMs.Add(item);
         db.SaveChanges();
     }
 }