public async Task <IHttpActionResult> PostProcedureVIEW(ProcedureVIEW procedureVIEW) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.ProcedureVIEWs.Add(procedureVIEW); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (ProcedureVIEWExists(procedureVIEW.procedureID)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = procedureVIEW.procedureID }, procedureVIEW)); }
public async Task <IHttpActionResult> PutProcedureVIEW(int id, ProcedureVIEW procedureVIEW) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != procedureVIEW.procedureID) { return(BadRequest()); } db.Entry(procedureVIEW).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProcedureVIEWExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GetProcedureVIEW(int id) { ProcedureVIEW procedureVIEW = await db.ProcedureVIEWs.FirstOrDefaultAsync(PR => PR.procedureID == id); if (procedureVIEW == null) { return(NotFound()); } return(Ok(procedureVIEW)); }
public async Task <IHttpActionResult> DeleteProcedureVIEW(int id) { ProcedureVIEW procedureVIEW = await db.ProcedureVIEWs.FindAsync(id); if (procedureVIEW == null) { return(NotFound()); } db.ProcedureVIEWs.Remove(procedureVIEW); await db.SaveChangesAsync(); return(Ok(procedureVIEW)); }