public async Task <IHttpActionResult> PutInventoryFact(int id, InventoryFact inventoryFact) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != inventoryFact.Id) { return(BadRequest()); } db.Entry(inventoryFact).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!InventoryFactExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GetInventoryFact(int id) { InventoryFact inventoryFact = await db.InventoryFact.FindAsync(id); if (inventoryFact == null) { return(NotFound()); } return(Ok(inventoryFact)); }
public async Task <IHttpActionResult> PostInventoryFact(InventoryFact inventoryFact) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.InventoryFact.Add(inventoryFact); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = inventoryFact.Id }, inventoryFact)); }
public async Task <IHttpActionResult> DeleteInventoryFact(int id) { InventoryFact inventoryFact = await db.InventoryFact.FindAsync(id); if (inventoryFact == null) { return(NotFound()); } db.InventoryFact.Remove(inventoryFact); await db.SaveChangesAsync(); return(Ok(inventoryFact)); }