Example #1
0
 //metodo Eliminar
 public void Eliminar()
 {
     try
     {
         using (var db = new Model_Sistema())
         {
             db.Entry(this).State = EntityState.Deleted;
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Example #2
0
        //metodo listar
        public List <Modelo> Listar()//Retorna una coleccion de registros
        {
            var objModelo = new List <Modelo>();

            try
            {
                using (var db = new Model_Sistema())
                {
                    objModelo = db.Modelo.ToList();
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(objModelo);
        }
Example #3
0
        //Metodo Listar
        public List <Semestre> Listar()
        {
            var objSemestre = new List <Semestre>();

            try
            {
                using (var db = new Model_Sistema())
                {
                    objSemestre = db.Semestre.ToList();
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(objSemestre);
        }
Example #4
0
        public List <Evidencia> Listar()//Retorna una coleccion de registros
        {
            var objEvidencia = new List <Evidencia>();

            try
            {
                using (var db = new Model_Sistema())
                {
                    objEvidencia = db.Evidencia.Include("Modelo").Include("Semestre").Include("Categoria").ToList();
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(objEvidencia);
        }
Example #5
0
        //metodo listar
        public List <Criterio> Listar()//Retorna una coleccion de registros
        {
            var objCriterio = new List <Criterio>();

            try
            {
                using (var db = new Model_Sistema())
                {
                    objCriterio = db.Criterio.Include("Modelo").ToList();
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(objCriterio);
        }
Example #6
0
        //Metodo Listar
        public List <Categoria> Listar()
        {
            var objCategoria = new List <Categoria>();

            try
            {
                using (var db = new Model_Sistema())
                {
                    objCategoria = db.Categoria.ToList();
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(objCategoria);
        }
Example #7
0
        //metodo obtener
        public Modelo Obtener(int id)//retorna solo un objeto
        {
            var objModelo = new Modelo();

            try
            {
                using (var db = new Model_Sistema())
                {
                    objModelo = db.Modelo
                                .Where(x => x.modelo_id == id)
                                .SingleOrDefault();
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(objModelo);
        }
Example #8
0
        //metodo obtener
        public Evidencia Obtener(int id)//retorna solo un objeto
        {
            var objEvidencia = new Evidencia();

            try
            {
                using (var db = new Model_Sistema())
                {
                    objEvidencia = db.Evidencia.Include("Modelo").Include("Semestre").Include("Categoria")
                                   .Where(x => x.evidencia_id == id)
                                   .SingleOrDefault();
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(objEvidencia);
        }
Example #9
0
        //Metodo Obtener
        public Semestre Obtener(int id)//retorna solo un objeto
        {
            var objSemestre = new Semestre();

            try
            {
                using (var db = new Model_Sistema())
                {
                    objSemestre = db.Semestre
                                  .Where(x => x.semestre_id == id)
                                  .SingleOrDefault();
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(objSemestre);
        }
Example #10
0
        //metodo obtener
        public Criterio Obtener(int id)//retorna solo un objeto
        {
            var objCriterio = new Criterio();

            try
            {
                using (var db = new Model_Sistema())
                {
                    objCriterio = db.Criterio.Include("Modelo")
                                  .Where(x => x.criterio_id == id)
                                  .SingleOrDefault();
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(objCriterio);
        }
Example #11
0
        //Metodo Obtener
        public Categoria Obtener(int id)//retorna solo un objeto
        {
            var objCategoria = new Categoria();

            try
            {
                using (var db = new Model_Sistema())
                {
                    objCategoria = db.Categoria
                                   .Where(x => x.categoria_id == id)
                                   .SingleOrDefault();
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(objCategoria);
        }
Example #12
0
        //Metodo Guardar

        public void Guardar()
        {
            try
            {
                using (var db = new Model_Sistema())
                {
                    if (this.semestre_id > 0)//sis existe un valor mayor a cero es porque existe registro
                    {
                        db.Entry(this).State = System.Data.Entity.EntityState.Modified;
                    }
                    else
                    {
                        //SINO EXISTE EL REGISTRO LO GRABA(nuevo)
                        db.Entry(this).State = System.Data.Entity.EntityState.Added;
                    }
                    db.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Example #13
0
 //metodo guardar
 public void Guardar()//retorna solo un objeto
 {
     try
     {
         using (var db = new Model_Sistema())
         {
             if (this.modelo_id > 0)
             {
                 //si existe un valor mayor a 0 es porque existe un registro
                 db.Entry(this).State = EntityState.Modified;
             }
             else
             {
                 //si no existe registro graba(nuevo registro)
                 db.Entry(this).State = EntityState.Added;
             }
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }