public async Task <IActionResult> PostNeedleRollerThrustRollerBrg([FromBody] NeedleRollerThrustRollerBrg needleRollerThrustRollerBrg) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.NeedleRollerThrustRollerBearings.Add(needleRollerThrustRollerBrg); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (NeedleRollerThrustRollerBrgExists(needleRollerThrustRollerBrg.TypeID)) { return(StatusCode((int)HttpStatusCode.Conflict)); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = needleRollerThrustRollerBrg.TypeID }, needleRollerThrustRollerBrg)); }
public async Task <IActionResult> PutNeedleRollerThrustRollerBrg(string id, [FromBody] NeedleRollerThrustRollerBrg needleRollerThrustRollerBrg) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != needleRollerThrustRollerBrg.TypeID) { return(BadRequest()); } db.Entry(needleRollerThrustRollerBrg).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!NeedleRollerThrustRollerBrgExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode((int)HttpStatusCode.NoContent)); }
public async Task <IActionResult> GetNeedleRollerThrustRollerBrg(string id) { NeedleRollerThrustRollerBrg needleRollerThrustRollerBrg = await db.NeedleRollerThrustRollerBearings.FindAsync(id); if (needleRollerThrustRollerBrg == null) { return(NotFound()); } return(Ok(needleRollerThrustRollerBrg)); }
public async Task <IActionResult> DeleteNeedleRollerThrustRollerBrg(string id) { NeedleRollerThrustRollerBrg needleRollerThrustRollerBrg = await db.NeedleRollerThrustRollerBearings.FindAsync(id); if (needleRollerThrustRollerBrg == null) { return(NotFound()); } db.NeedleRollerThrustRollerBearings.Remove(needleRollerThrustRollerBrg); await db.SaveChangesAsync(); return(Ok(needleRollerThrustRollerBrg)); }