public async Task <IActionResult> PostPMSrvMotorDriver([FromBody] PMSrvMotorDriver pMSrvMotorDriver) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.PMSrvMotorDrivers.Add(pMSrvMotorDriver); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (PMSrvMotorDriverExists(pMSrvMotorDriver.TypeID)) { return(StatusCode((int)HttpStatusCode.Conflict)); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = pMSrvMotorDriver.TypeID }, pMSrvMotorDriver)); }
public async Task <IActionResult> PutPMSrvMotorDriver(string id, [FromBody] PMSrvMotorDriver pMSrvMotorDriver) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != pMSrvMotorDriver.TypeID) { return(BadRequest()); } db.Entry(pMSrvMotorDriver).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PMSrvMotorDriverExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode((int)HttpStatusCode.NoContent)); }
public async Task <IActionResult> GetPMSrvMotorDriver(string id) { PMSrvMotorDriver pMSrvMotorDriver = await db.PMSrvMotorDrivers.FindAsync(id); if (pMSrvMotorDriver == null) { return(NotFound()); } return(Ok(pMSrvMotorDriver)); }
public async Task <IActionResult> DeletePMSrvMotorDriver(string id) { PMSrvMotorDriver pMSrvMotorDriver = await db.PMSrvMotorDrivers.FindAsync(id); if (pMSrvMotorDriver == null) { return(NotFound()); } db.PMSrvMotorDrivers.Remove(pMSrvMotorDriver); await db.SaveChangesAsync(); return(Ok(pMSrvMotorDriver)); }