Exemple #1
0
        public IHttpActionResult PostTR_RTF_ESC(TR_RTF_ESC tR_RTF_ESC)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.TR_RTF_ESC.Add(tR_RTF_ESC);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (TR_RTF_ESCExists(tR_RTF_ESC.cs_codigo_rtf))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = tR_RTF_ESC.cs_codigo_rtf }, tR_RTF_ESC));
        }
Exemple #2
0
        public IHttpActionResult PutTR_RTF_ESC(string id, TR_RTF_ESC tR_RTF_ESC)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != tR_RTF_ESC.cs_codigo_rtf)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemple #3
0
        public IHttpActionResult GetTR_RTF_ESC(string id)
        {
            TR_RTF_ESC tR_RTF_ESC = db.TR_RTF_ESC.Find(id);

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

            return(Ok(tR_RTF_ESC));
        }
Exemple #4
0
        public IHttpActionResult DeleteTR_RTF_ESC(string id)
        {
            TR_RTF_ESC tR_RTF_ESC = db.TR_RTF_ESC.Find(id);

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

            db.TR_RTF_ESC.Remove(tR_RTF_ESC);
            db.SaveChanges();

            return(Ok(tR_RTF_ESC));
        }