public async Task<IHttpActionResult> PostSrvDriverReactor(SrvDriverReactor srvDriverReactor) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.SrvDriverReactors.Add(srvDriverReactor); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (SrvDriverReactorExists(srvDriverReactor.TypeID)) { return Conflict(); } else { throw; } } return CreatedAtRoute("DefaultApi", new { id = srvDriverReactor.TypeID }, srvDriverReactor); }
public async Task<IHttpActionResult> PutSrvDriverReactor(string id, SrvDriverReactor srvDriverReactor) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != srvDriverReactor.TypeID) { return BadRequest(); } db.Entry(srvDriverReactor).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SrvDriverReactorExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }