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)); }
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)); }
public IHttpActionResult GetGoodsIssued(string id) { GoodsIssued goodsIssued = db.GoodsIssueds.Find(id); if (goodsIssued == null) { return(NotFound()); } return(Ok(goodsIssued)); }
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)); }