public async Task<IHttpActionResult> PostRotaryTable(RotaryTable rotaryTable) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.RotaryTables.Add(rotaryTable); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (RotaryTableExists(rotaryTable.TypeID)) { return Conflict(); } else { throw; } } return CreatedAtRoute("DefaultApi", new { id = rotaryTable.TypeID }, rotaryTable); }
public async Task<IHttpActionResult> PutRotaryTable(string id, RotaryTable rotaryTable) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != rotaryTable.TypeID) { return BadRequest(); } db.Entry(rotaryTable).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RotaryTableExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }