Example #1
0
 public void Eliminar()
 {
     try
     {
         using (var db = new ModeloCONCURSO())
         {
             db.Entry(this).State = EntityState.Deleted;
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Example #2
0
        public List <CONCURSO> Listar()
        {
            var proyecto = new List <CONCURSO>();

            try
            {
                using (var db = new ModeloCONCURSO())
                {
                    proyecto = db.CONCURSO.Include("CATEGORIAS").ToList();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return(proyecto);
        }
Example #3
0
        public List <CONCURSO> ListarB()
        {
            var proyecto = new List <CONCURSO>();

            try
            {
                using (var db = new ModeloCONCURSO())
                {
                    proyecto = db.CONCURSO.Include("CATEGORIAS").Where(x => x.CATEGORIAS.NOMBRECATEGORIA.Equals("B")).ToList();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return(proyecto);
        }
        public List <CATEGORIAS> Listar()
        {
            var categorias = new List <CATEGORIAS>();

            try
            {
                using (var db = new ModeloCONCURSO())
                {
                    categorias = db.CATEGORIAS.ToList();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return(categorias);
        }
Example #5
0
        public CONCURSO Obtener(int id)
        {
            var proyecto = new CONCURSO();

            try
            {
                using (var context = new ModeloCONCURSO())
                {
                    proyecto = context.CONCURSO.Include("CATEGORIAS")
                               .Where(x => x.IDCONCURSO == id)
                               .Single();
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }


            return(proyecto);
        }
        public CATEGORIAS Obtener(int id)
        {
            var cate = new CATEGORIAS();

            try
            {
                using (var context = new ModeloCONCURSO())
                {
                    cate = context.CATEGORIAS
                           .Where(x => x.IDCATEGORIA == id)
                           .Single();
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }


            return(cate);
        }
Example #7
0
 public void Guardar()
 {
     try
     {
         using (var db = new ModeloCONCURSO())
         {
             if (this.IDCONCURSO > 0)
             {
                 db.Entry(this).State = EntityState.Modified;
             }
             else
             {
                 db.Entry(this).State = EntityState.Added;
             }
             db.SaveChanges();
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
 public void Guardar()
 {
     try
     {
         using (var db = new ModeloCONCURSO())
         {
             if (this.IDCATEGORIA > 0)
             {
                 db.Entry(this).State = EntityState.Modified;
             }
             else
             {
                 db.Entry(this).State = EntityState.Added;
             }
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }