public IHttpActionResult PostInwardDelItem(InwardDelItem inwardDelItem) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.InwardDelItems.Add(inwardDelItem); try { db.SaveChanges(); } catch (DbUpdateException) { if (InwardDelItemExists(inwardDelItem.InwardDelItemID)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = inwardDelItem.InwardDelItemID }, inwardDelItem)); }
public IHttpActionResult PutInwardDelItem(string id, InwardDelItem inwardDelItem) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != inwardDelItem.InwardDelItemID) { return(BadRequest()); } db.Entry(inwardDelItem).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!InwardDelItemExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetInwardDelItem(string id) { InwardDelItem inwardDelItem = db.InwardDelItems.Find(id); if (inwardDelItem == null) { return(NotFound()); } return(Ok(inwardDelItem)); }
public IHttpActionResult DeleteInwardDelItem(string id) { InwardDelItem inwardDelItem = db.InwardDelItems.Find(id); if (inwardDelItem == null) { return(NotFound()); } db.InwardDelItems.Remove(inwardDelItem); db.SaveChanges(); return(Ok(inwardDelItem)); }