public async Task <IActionResult> PostAlignRollerBrg([FromBody] AlignRollerBrg alignRollerBrg) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.AlignRollerBearings.Add(alignRollerBrg); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (AlignRollerBrgExists(alignRollerBrg.TypeID)) { return(StatusCode((int)HttpStatusCode.Conflict)); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = alignRollerBrg.TypeID }, alignRollerBrg)); }
public async Task <IActionResult> PutAlignRollerBrg(string id, [FromBody] AlignRollerBrg alignRollerBrg) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != alignRollerBrg.TypeID) { return(BadRequest()); } db.Entry(alignRollerBrg).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AlignRollerBrgExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode((int)HttpStatusCode.NoContent)); }
public async Task<IHttpActionResult> GetAlignRollerBrg(string id) { AlignRollerBrg alignRollerBrg = await db.AlignRollerBearings.FindAsync(id); if (alignRollerBrg == null) { return NotFound(); } return Ok(alignRollerBrg); }
public async Task<IHttpActionResult> DeleteAlignRollerBrg(string id) { AlignRollerBrg alignRollerBrg = await db.AlignRollerBearings.FindAsync(id); if (alignRollerBrg == null) { return NotFound(); } db.AlignRollerBearings.Remove(alignRollerBrg); await db.SaveChangesAsync(); return Ok(alignRollerBrg); }