Пример #1
0
        public IHttpActionResult PostGoodsIssued(GoodsIssued goodsIssued)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.GoodsIssueds.Add(goodsIssued);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (GoodsIssuedExists(goodsIssued.GoodsIssuedID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = goodsIssued.GoodsIssuedID }, goodsIssued));
        }
Пример #2
0
        public IHttpActionResult PutGoodsIssued(string id, GoodsIssued goodsIssued)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != goodsIssued.GoodsIssuedID)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #3
0
        public IHttpActionResult GetGoodsIssued(string id)
        {
            GoodsIssued goodsIssued = db.GoodsIssueds.Find(id);

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

            return(Ok(goodsIssued));
        }
Пример #4
0
        public IHttpActionResult DeleteGoodsIssued(string id)
        {
            GoodsIssued goodsIssued = db.GoodsIssueds.Find(id);

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

            db.GoodsIssueds.Remove(goodsIssued);
            db.SaveChanges();

            return(Ok(goodsIssued));
        }