public async Task <IHttpActionResult> PostPMSrvMotorPara(PMSrvMotorPara pMSrvMotorPara) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.PMSrvMotorParas.Add(pMSrvMotorPara); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (PMSrvMotorParaExists(pMSrvMotorPara.TypeID)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = pMSrvMotorPara.TypeID }, pMSrvMotorPara)); }
public async Task <IHttpActionResult> PutPMSrvMotorPara(string id, PMSrvMotorPara pMSrvMotorPara) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != pMSrvMotorPara.TypeID) { return(BadRequest()); } db.Entry(pMSrvMotorPara).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PMSrvMotorParaExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GetPMSrvMotorPara(string id) { PMSrvMotorPara pMSrvMotorPara = await db.PMSrvMotorParas.FindAsync(id); if (pMSrvMotorPara == null) { return(NotFound()); } return(Ok(pMSrvMotorPara)); }
public async Task <IHttpActionResult> DeletePMSrvMotorPara(string id) { PMSrvMotorPara pMSrvMotorPara = await db.PMSrvMotorParas.FindAsync(id); if (pMSrvMotorPara == null) { return(NotFound()); } db.PMSrvMotorParas.Remove(pMSrvMotorPara); await db.SaveChangesAsync(); return(Ok(pMSrvMotorPara)); }