예제 #1
0
        public IHttpActionResult PostTRIBUNAL_JUSTICIA(TRIBUNAL_JUSTICIA tRIBUNAL_JUSTICIA)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            tRIBUNAL_JUSTICIA.ESTADO = "Recepcionado";
            db.TRIBUNAL_JUSTICIA.Add(tRIBUNAL_JUSTICIA);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (TRIBUNAL_JUSTICIAExists(tRIBUNAL_JUSTICIA.ID_REGISTRO))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }
            return(CreatedAtRoute("DefaultApi", new { id = tRIBUNAL_JUSTICIA.ID_REGISTRO }, tRIBUNAL_JUSTICIA));
        }
예제 #2
0
        public IHttpActionResult PutTRIBUNAL_JUSTICIA(long id, TRIBUNAL_JUSTICIA tRIBUNAL_JUSTICIA)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != tRIBUNAL_JUSTICIA.ID_REGISTRO)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #3
0
        public IHttpActionResult GetTRIBUNAL_JUSTICIA(long id)
        {
            TRIBUNAL_JUSTICIA tRIBUNAL_JUSTICIA = db.TRIBUNAL_JUSTICIA.Find(id);

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

            return(Ok(tRIBUNAL_JUSTICIA));
        }
예제 #4
0
        public IHttpActionResult DeleteTRIBUNAL_JUSTICIA(long id)
        {
            TRIBUNAL_JUSTICIA tRIBUNAL_JUSTICIA = db.TRIBUNAL_JUSTICIA.Find(id);

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

            db.TRIBUNAL_JUSTICIA.Remove(tRIBUNAL_JUSTICIA);
            db.SaveChanges();

            return(Ok(tRIBUNAL_JUSTICIA));
        }