public async Task <IActionResult> PostStepMotorPara([FromBody] StepMotorPara stepMotorPara) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.StepMotorParas.Add(stepMotorPara); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (StepMotorParaExists(stepMotorPara.TypeID)) { return(StatusCode((int)HttpStatusCode.Conflict)); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = stepMotorPara.TypeID }, stepMotorPara)); }
public async Task <IActionResult> PutStepMotorPara(string id, [FromBody] StepMotorPara stepMotorPara) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != stepMotorPara.TypeID) { return(BadRequest()); } db.Entry(stepMotorPara).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StepMotorParaExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode((int)HttpStatusCode.NoContent)); }
public async Task <IActionResult> GetStepMotorPara(string id) { StepMotorPara stepMotorPara = await db.StepMotorParas.FindAsync(id); if (stepMotorPara == null) { return(NotFound()); } return(Ok(stepMotorPara)); }
public async Task <IActionResult> DeleteStepMotorPara(string id) { StepMotorPara stepMotorPara = await db.StepMotorParas.FindAsync(id); if (stepMotorPara == null) { return(NotFound()); } db.StepMotorParas.Remove(stepMotorPara); await db.SaveChangesAsync(); return(Ok(stepMotorPara)); }