// POST: odata/ProductInventories public IHttpActionResult Post(FactProductInventory factProductInventory) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.FactProductInventories.Add(factProductInventory); try { db.SaveChanges(); } catch (DbUpdateException) { if (FactProductInventoryExists(factProductInventory.ProductKey, factProductInventory.DateKey)) { return(Conflict()); } else { throw; } } return(Created(factProductInventory)); }
// DELETE: odata/ProductInventories(5) public IHttpActionResult Delete([FromODataUri] int keyProductKey, [FromODataUri] int keyDateKey) { FactProductInventory factProductInventory = db.FactProductInventories.Find(keyProductKey, keyDateKey); if (factProductInventory == null) { return(NotFound()); } db.FactProductInventories.Remove(factProductInventory); db.SaveChanges(); return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult Patch([FromODataUri] int keyProductKey, [FromODataUri] int keyDateKey, Delta <FactProductInventory> patch) { Validate(patch.GetInstance()); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } FactProductInventory factProductInventory = db.FactProductInventories.Find(keyProductKey, keyDateKey); if (factProductInventory == null) { return(NotFound()); } patch.Patch(factProductInventory); try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!FactProductInventoryExists(keyProductKey, keyDateKey)) { return(NotFound()); } else { throw; } } return(Updated(factProductInventory)); }