public async Task <IActionResult> PostDoubleRowCylinRollerBrg([FromBody] DoubleRowCylinRollerBrg doubleRowCylinRollerBrg) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.DoubleRowCylinRollerBearings.Add(doubleRowCylinRollerBrg); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (DoubleRowCylinRollerBrgExists(doubleRowCylinRollerBrg.TypeID)) { return(StatusCode((int)HttpStatusCode.Conflict)); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = doubleRowCylinRollerBrg.TypeID }, doubleRowCylinRollerBrg)); }
public async Task <IActionResult> PutDoubleRowCylinRollerBrg(string id, [FromBody] DoubleRowCylinRollerBrg doubleRowCylinRollerBrg) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != doubleRowCylinRollerBrg.TypeID) { return(BadRequest()); } db.Entry(doubleRowCylinRollerBrg).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DoubleRowCylinRollerBrgExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode((int)HttpStatusCode.NoContent)); }
public async Task<IHttpActionResult> PostDoubleRowCylinRollerBrg(DoubleRowCylinRollerBrg doubleRowCylinRollerBrg) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.DoubleRowCylinRollerBearings.Add(doubleRowCylinRollerBrg); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (DoubleRowCylinRollerBrgExists(doubleRowCylinRollerBrg.TypeID)) { return Conflict(); } else { throw; } } return CreatedAtRoute("DefaultApi", new { id = doubleRowCylinRollerBrg.TypeID }, doubleRowCylinRollerBrg); }
public async Task<IHttpActionResult> PutDoubleRowCylinRollerBrg(string id, DoubleRowCylinRollerBrg doubleRowCylinRollerBrg) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != doubleRowCylinRollerBrg.TypeID) { return BadRequest(); } db.Entry(doubleRowCylinRollerBrg).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DoubleRowCylinRollerBrgExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public async Task <IActionResult> GetDoubleRowCylinRollerBrg(string id) { DoubleRowCylinRollerBrg doubleRowCylinRollerBrg = await db.DoubleRowCylinRollerBearings.FindAsync(id); if (doubleRowCylinRollerBrg == null) { return(NotFound()); } return(Ok(doubleRowCylinRollerBrg)); }
public async Task <IActionResult> DeleteDoubleRowCylinRollerBrg(string id) { DoubleRowCylinRollerBrg doubleRowCylinRollerBrg = await db.DoubleRowCylinRollerBearings.FindAsync(id); if (doubleRowCylinRollerBrg == null) { return(NotFound()); } db.DoubleRowCylinRollerBearings.Remove(doubleRowCylinRollerBrg); await db.SaveChangesAsync(); return(Ok(doubleRowCylinRollerBrg)); }