public async Task <IHttpActionResult> PostNCSystemFunctionalOption(NCSystemFunctionalOptions nCSystemFunctionalOptions) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.NCSystemFunctionalOptions.Add(nCSystemFunctionalOptions); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (NCSystemFunctionalOptionsExists(nCSystemFunctionalOptions.TypeID)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = nCSystemFunctionalOptions.TypeID }, nCSystemFunctionalOptions)); }
public async Task <IHttpActionResult> PutNCSystemFunctionalOption(string id, NCSystemFunctionalOptions nCSystemFunctionalOptions) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != nCSystemFunctionalOptions.TypeID) { return(BadRequest()); } db.Entry(nCSystemFunctionalOptions).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!NCSystemFunctionalOptionsExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GetNCSystemFunctionalOption(string id) { NCSystemFunctionalOptions nCSystemFunctionalOptions = await db.NCSystemFunctionalOptions.FindAsync(id); if (nCSystemFunctionalOptions == null) { return(NotFound()); } return(Ok(nCSystemFunctionalOptions)); }
public async Task <IHttpActionResult> DeleteNCSystemFunctionalOption(string id) { NCSystemFunctionalOptions nCSystemFunctionalOptions = await db.NCSystemFunctionalOptions.FindAsync(id); if (nCSystemFunctionalOptions == null) { return(NotFound()); } db.NCSystemFunctionalOptions.Remove(nCSystemFunctionalOptions); await db.SaveChangesAsync(); return(Ok(nCSystemFunctionalOptions)); }