public async Task <IActionResult> PostSpindleSrvMotorPara([FromBody] SpindleSrvMotorPara spindleSrvMotorPara) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.SpindleSrvMotorParas.Add(spindleSrvMotorPara); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (SpindleSrvMotorParaExists(spindleSrvMotorPara.TypeID)) { return(StatusCode((int)HttpStatusCode.Conflict)); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = spindleSrvMotorPara.TypeID }, spindleSrvMotorPara)); }
public async Task <IActionResult> PutSpindleSrvMotorPara(string id, [FromBody] SpindleSrvMotorPara spindleSrvMotorPara) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != spindleSrvMotorPara.TypeID) { return(BadRequest()); } db.Entry(spindleSrvMotorPara).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SpindleSrvMotorParaExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode((int)HttpStatusCode.NoContent)); }
public async Task <IActionResult> GetSpindleSrvMotorPara(string id) { SpindleSrvMotorPara spindleSrvMotorPara = await db.SpindleSrvMotorParas.FindAsync(id); if (spindleSrvMotorPara == null) { return(NotFound()); } return(Ok(spindleSrvMotorPara)); }
public async Task <IActionResult> DeleteSpindleSrvMotorPara(string id) { SpindleSrvMotorPara spindleSrvMotorPara = await db.SpindleSrvMotorParas.FindAsync(id); if (spindleSrvMotorPara == null) { return(NotFound()); } db.SpindleSrvMotorParas.Remove(spindleSrvMotorPara); await db.SaveChangesAsync(); return(Ok(spindleSrvMotorPara)); }