public async Task <IHttpActionResult> PutOrder(string id, Order order) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != order.Id) { return(BadRequest()); } db.Entry(order).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OrderExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }