public async Task <IActionResult> PostTaperedRollerBrg([FromBody] TaperedRollerBrg taperedRollerBrg) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.TaperedRollerBearings.Add(taperedRollerBrg); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (TaperedRollerBrgExists(taperedRollerBrg.TypeID)) { return(StatusCode((int)HttpStatusCode.Conflict)); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = taperedRollerBrg.TypeID }, taperedRollerBrg)); }
public async Task <IActionResult> PutTaperedRollerBrg(string id, [FromBody] TaperedRollerBrg taperedRollerBrg) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != taperedRollerBrg.TypeID) { return(BadRequest()); } db.Entry(taperedRollerBrg).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TaperedRollerBrgExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode((int)HttpStatusCode.NoContent)); }
public async Task <IActionResult> GetTaperedRollerBrg(string id) { TaperedRollerBrg taperedRollerBrg = await db.TaperedRollerBearings.FindAsync(id); if (taperedRollerBrg == null) { return(NotFound()); } return(Ok(taperedRollerBrg)); }
public async Task <IActionResult> DeleteTaperedRollerBrg(string id) { TaperedRollerBrg taperedRollerBrg = await db.TaperedRollerBearings.FindAsync(id); if (taperedRollerBrg == null) { return(NotFound()); } db.TaperedRollerBearings.Remove(taperedRollerBrg); await db.SaveChangesAsync(); return(Ok(taperedRollerBrg)); }