Exemplo n.º 1
0
        public ActionResult Form(int?id, Operaciones operaciones)
        {
            var grupos = new Grupos();

            using (MyDbContext context = new MyDbContext())
            {
                //crear instancia de la DAL y se pasa el contexto de la bd
                CarrerasDAL   dal  = new CarrerasDAL(context);
                MateriasDAL   dal2 = new MateriasDAL(context);
                ProfesoresDAL dal3 = new ProfesoresDAL(context);

                //llamada al metodo para obtener todos los registros
                List <Carreras>   lstCarreras   = dal.obtenerTodos();
                List <Materias>   lstMaterias   = dal2.obtenerTodos();
                List <Profesores> lstProfesores = dal3.obtenerTodos();

                ViewBag.Carreras   = lstCarreras;
                ViewBag.Materias   = lstMaterias;
                ViewBag.Profesores = lstProfesores;
            }

            //Si el id tiene un valor; entonces se procede a buscar una carrera
            if (id.HasValue)
            {
                grupos = servicio.obtenerPorId(id.Value);
            }
            ViewData["Operacion"] = operaciones;
            return(View(grupos));
        }
Exemplo n.º 2
0
        //Para obtener por ID

        public Materias obtenerPorId(int id)
        {
            try
            {
                using (MyDbContext context = new MyDbContext())
                {
                    //crear instancia de la DAL y se pasa el contexto de la bd
                    MateriasDAL dal = new MateriasDAL(context);

                    //llamada al metodo para obtener todos los registros
                    return(dal.obtenerPorID(id));
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Exemplo n.º 3
0
        //Para modificar una carrera
        public int modificar(int id, Materias materias)
        {
            try
            {
                using (MyDbContext context = new MyDbContext())
                {
                    //crear instancia de la DAL y se pasa el contexto de la bd
                    MateriasDAL dal = new MateriasDAL(context);

                    //llamada al metodo para obtener todos los registros
                    return(dal.modificarMaterias(id, materias));
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Exemplo n.º 4
0
 public GruposBLL(string stringConnection)
 {
     this.stringConnection = stringConnection;
     _GrupoDAL             = new GruposDAL(this.stringConnection);
     _MateriaDAL           = new MateriasDAL(this.stringConnection);
 }
Exemplo n.º 5
0
 public MateriasController()
 {
     materias = new MateriasDAL();
 }
Exemplo n.º 6
0
 public MateriasBLL(string stringConnection)
 {
     this.stringConnection = stringConnection;
     _MateriaDAL           = new MateriasDAL(this.stringConnection);
 }