public async Task <IHttpActionResult> PostNCSystemManual(NCSystemManual nCSystemManual) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.NCSystemManuals.Add(nCSystemManual); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (NCSystemManualExists(nCSystemManual.TypeID)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = nCSystemManual.TypeID }, nCSystemManual)); }
public async Task <IHttpActionResult> PutNCSystemManual(string id, NCSystemManual nCSystemManual) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != nCSystemManual.TypeID) { return(BadRequest()); } db.Entry(nCSystemManual).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!NCSystemManualExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task<IHttpActionResult> PostNCSystemManual(NCSystemManual nCSystemManual) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.NCSystemManuals.Add(nCSystemManual); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (NCSystemManualExists(nCSystemManual.TypeID)) { return Conflict(); } else { throw; } } return CreatedAtRoute("DefaultApi", new { id = nCSystemManual.TypeID }, nCSystemManual); }
public async Task<IHttpActionResult> PutNCSystemManual(string id, NCSystemManual nCSystemManual) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != nCSystemManual.TypeID) { return BadRequest(); } db.Entry(nCSystemManual).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!NCSystemManualExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public async Task <IHttpActionResult> GetNCSystemManual(string id) { NCSystemManual nCSystemManual = await db.NCSystemManuals.FindAsync(id); if (nCSystemManual == null) { return(NotFound()); } return(Ok(nCSystemManual)); }
public async Task <IHttpActionResult> DeleteNCSystemManual(string id) { NCSystemManual nCSystemManual = await db.NCSystemManuals.FindAsync(id); if (nCSystemManual == null) { return(NotFound()); } db.NCSystemManuals.Remove(nCSystemManual); await db.SaveChangesAsync(); return(Ok(nCSystemManual)); }