// POST: odata/ReorderRequireds public IHttpActionResult Post(ReorderRequired reorderRequired) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.ReorderRequireds.Add(reorderRequired); try { db.SaveChanges(); } catch (DbUpdateException) { if (ReorderRequiredExists(reorderRequired.MaterialId)) { return(Conflict()); } else { throw; } } return(Created(reorderRequired)); }
// DELETE: odata/ReorderRequireds(5) public IHttpActionResult Delete([FromODataUri] int key) { ReorderRequired reorderRequired = db.ReorderRequireds.Find(key); if (reorderRequired == null) { return(NotFound()); } db.ReorderRequireds.Remove(reorderRequired); db.SaveChanges(); return(StatusCode(HttpStatusCode.NoContent)); }
// PUT: odata/ReorderRequireds(5) public IHttpActionResult Put([FromODataUri] int key, Delta <ReorderRequired> patch) { Validate(patch.GetEntity()); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } ReorderRequired reorderRequired = db.ReorderRequireds.Find(key); if (reorderRequired == null) { return(NotFound()); } patch.Put(reorderRequired); try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ReorderRequiredExists(key)) { return(NotFound()); } else { throw; } } return(Updated(reorderRequired)); }