public IHttpActionResult PutStockInHand(int id, StockInHand stockInHand) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != stockInHand.Id) { return BadRequest(); } db.Entry(stockInHand).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!StockInHandExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostStockInHand(StockInHand stockInHand) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.StockInHands.Add(stockInHand); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = stockInHand.Id }, stockInHand); }