public async Task<IHttpActionResult> PostSpindleBeltLength(SpindleBeltLength spindleBeltLength) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.SpindleBeltLengths.Add(spindleBeltLength); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (SpindleBeltLengthExists(spindleBeltLength.LengthID)) { return Conflict(); } else { throw; } } return CreatedAtRoute("DefaultApi", new { id = spindleBeltLength.LengthID }, spindleBeltLength); }
public async Task<IHttpActionResult> PutSpindleBeltLength(int id, SpindleBeltLength spindleBeltLength) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != spindleBeltLength.LengthID) { return BadRequest(); } db.Entry(spindleBeltLength).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SpindleBeltLengthExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public async Task <IHttpActionResult> PostSpindleBeltLength(SpindleBeltLength spindleBeltLength) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.SpindleBeltLengths.Add(spindleBeltLength); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (SpindleBeltLengthExists(spindleBeltLength.LengthID)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = spindleBeltLength.LengthID }, spindleBeltLength)); }
public async Task <IHttpActionResult> PutSpindleBeltLength(int id, SpindleBeltLength spindleBeltLength) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != spindleBeltLength.LengthID) { return(BadRequest()); } db.Entry(spindleBeltLength).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SpindleBeltLengthExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GetSpindleBeltLength(int id) { SpindleBeltLength spindleBeltLength = await db.SpindleBeltLengths.FindAsync(id); if (spindleBeltLength == null) { return(NotFound()); } return(Ok(spindleBeltLength)); }
public async Task <IHttpActionResult> DeleteSpindleBeltLength(int id) { SpindleBeltLength spindleBeltLength = await db.SpindleBeltLengths.FindAsync(id); if (spindleBeltLength == null) { return(NotFound()); } db.SpindleBeltLengths.Remove(spindleBeltLength); await db.SaveChangesAsync(); return(Ok(spindleBeltLength)); }