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));
        }
        //Para obtener por ID

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

                    //llamada al metodo para obtener todos los registros
                    return(dal.obtenerPorID(id));
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        //Para modificar un estudiante
        public int modificar(int id, Profesores profesores)
        {
            try
            {
                using (MyDbContext context = new MyDbContext())
                {
                    //crear instancia de la DAL y se pasa el contexto de la bd
                    ProfesoresDAL dal = new ProfesoresDAL(context);

                    //llamada al metodo para obtener todos los registros
                    return(dal.modificarProfesores(id, profesores));
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }