コード例 #1
0
        public IHttpActionResult PostTR_LIBROS_CONFIGURADOS(TR_LIBROS_CONFIGURADOS tR_LIBROS_CONFIGURADOS)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.TR_LIBROS_CONFIGURADOS.Add(tR_LIBROS_CONFIGURADOS);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (TR_LIBROS_CONFIGURADOSExists(tR_LIBROS_CONFIGURADOS.CS_DOCUMENTO))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = tR_LIBROS_CONFIGURADOS.CS_DOCUMENTO }, tR_LIBROS_CONFIGURADOS));
        }
コード例 #2
0
        public IHttpActionResult PutTR_LIBROS_CONFIGURADOS(string id, TR_LIBROS_CONFIGURADOS tR_LIBROS_CONFIGURADOS)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != tR_LIBROS_CONFIGURADOS.CS_DOCUMENTO)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #3
0
        public IHttpActionResult GetTR_LIBROS_CONFIGURADOS(string id)
        {
            TR_LIBROS_CONFIGURADOS tR_LIBROS_CONFIGURADOS = db.TR_LIBROS_CONFIGURADOS.Find(id);

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

            return(Ok(tR_LIBROS_CONFIGURADOS));
        }
コード例 #4
0
        public IHttpActionResult DeleteTR_LIBROS_CONFIGURADOS(string id)
        {
            TR_LIBROS_CONFIGURADOS tR_LIBROS_CONFIGURADOS = db.TR_LIBROS_CONFIGURADOS.Find(id);

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

            db.TR_LIBROS_CONFIGURADOS.Remove(tR_LIBROS_CONFIGURADOS);
            db.SaveChanges();

            return(Ok(tR_LIBROS_CONFIGURADOS));
        }