public async Task<IHttpActionResult> PostAlignBallBrg(AlignBallBrg alignBallBrg) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.AlignBallBearings.Add(alignBallBrg); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (AlignBallBrgExists(alignBallBrg.TypeID)) { return Conflict(); } else { throw; } } return CreatedAtRoute("DefaultApi", new { id = alignBallBrg.TypeID }, alignBallBrg); }
public async Task<IHttpActionResult> PutAlignBallBrg(string id, AlignBallBrg alignBallBrg) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != alignBallBrg.TypeID) { return BadRequest(); } db.Entry(alignBallBrg).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AlignBallBrgExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }