public IHttpActionResult PostPETCheck(PETCheck pETCheck) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.PETChecks.Add(pETCheck); try { db.SaveChanges(); } catch (DbUpdateException) { if (PETCheckExists(pETCheck.ProcessOrderNo)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = pETCheck.ProcessOrderNo }, pETCheck)); }
public IHttpActionResult PutPETCheck(int id, PETCheck pETCheck) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != pETCheck.ProcessOrderNo) { return(BadRequest()); } db.Entry(pETCheck).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!PETCheckExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetPETCheck(int id) { PETCheck pETCheck = db.PETChecks.Find(id); if (pETCheck == null) { return(NotFound()); } return(Ok(pETCheck)); }
public IHttpActionResult DeletePETCheck(int id) { PETCheck pETCheck = db.PETChecks.Find(id); if (pETCheck == null) { return(NotFound()); } db.PETChecks.Remove(pETCheck); db.SaveChanges(); return(Ok(pETCheck)); }