public async Task <IHttpActionResult> PostSpindleSrvMotorSize(SpindleSrvMotorSize spindleSrvMotorSize) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.SpindleSrvMotorSizes.Add(spindleSrvMotorSize); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (SpindleSrvMotorSizeExists(spindleSrvMotorSize.TypeID)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = spindleSrvMotorSize.TypeID }, spindleSrvMotorSize)); }
public async Task <IHttpActionResult> PutSpindleSrvMotorSize(string id, SpindleSrvMotorSize spindleSrvMotorSize) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != spindleSrvMotorSize.TypeID) { return(BadRequest()); } db.Entry(spindleSrvMotorSize).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SpindleSrvMotorSizeExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GetSpindleSrvMotorSize(string id) { SpindleSrvMotorSize spindleSrvMotorSize = await db.SpindleSrvMotorSizes.FindAsync(id); if (spindleSrvMotorSize == null) { return(NotFound()); } return(Ok(spindleSrvMotorSize)); }
public async Task <IHttpActionResult> DeleteSpindleSrvMotorSize(string id) { SpindleSrvMotorSize spindleSrvMotorSize = await db.SpindleSrvMotorSizes.FindAsync(id); if (spindleSrvMotorSize == null) { return(NotFound()); } db.SpindleSrvMotorSizes.Remove(spindleSrvMotorSize); await db.SaveChangesAsync(); return(Ok(spindleSrvMotorSize)); }