public IHttpActionResult PutInventory(int id, Inventory inventory) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != inventory.Id) { return(BadRequest()); } try { _repository.Save(inventory); } catch (Exception ex) { //must be other actions throw; } return(StatusCode(HttpStatusCode.NoContent)); }