示例#1
0
        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));
        }
示例#2
0
        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));
        }
示例#3
0
        public IHttpActionResult GetPETCheck(int id)
        {
            PETCheck pETCheck = db.PETChecks.Find(id);

            if (pETCheck == null)
            {
                return(NotFound());
            }

            return(Ok(pETCheck));
        }
示例#4
0
        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));
        }