示例#1
0
        public IHttpActionResult PostJusProcedure(JusProcedure jusProcedure)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.JusProcedures.Add(jusProcedure);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (JusProcedureExists(jusProcedure.ProcedureID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = jusProcedure.ProcedureID }, jusProcedure));
        }
示例#2
0
        public IHttpActionResult PutJusProcedure(int id, JusProcedure jusProcedure)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != jusProcedure.ProcedureID)
            {
                return(BadRequest());
            }

            db.Entry(jusProcedure).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!JusProcedureExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
示例#3
0
        public IHttpActionResult GetJusProcedure(int id)
        {
            JusProcedure jusProcedure = db.JusProcedures.Find(id);

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

            return(Ok(jusProcedure));
        }
示例#4
0
        public IHttpActionResult DeleteJusProcedure(int id)
        {
            JusProcedure jusProcedure = db.JusProcedures.Find(id);

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

            db.JusProcedures.Remove(jusProcedure);
            db.SaveChanges();

            return(Ok(jusProcedure));
        }