Esempio n. 1
0
        public IActionResult Index(int id, string filtrar)
        {
            Object[] objects = new Object[3];
            var      data    = _curso.getTCursos(filtrar);

            if (0 < data.Count)
            {
                var url = Request.Scheme + "://" + Request.Host.Value;
                objects = new LPaginador <TCursos>().paginador(data, id, 10, "", "Home", "Index", url);
            }
            else
            {
                objects[0] = "No hay datos que mostrar";
                objects[1] = "No hay datos que mostrar";
                objects[2] = new List <TCursos>();
            }

            models = new DataPaginador <TCursos>
            {
                List            = (List <TCursos>)objects[2],
                Pagi_info       = (String)objects[0],
                Pagi_navegacion = (String)objects[1],
                Input           = new TCursos(),
            };

            if (identityError != null)
            {
                models.Pagi_info = identityError.Description;
                identityError    = null;
            }
            //await CreateRolesAsync(_serviceProvider);
            return(View(models));
        }
Esempio n. 2
0
        [Authorize(Roles = "Admin")] // se restringe el acceso al metodo para mayor seguridad
        public IActionResult Cursos(int id, string Search, int Registros)
        {
            if (_signInManager.IsSignedIn(User))
            {
                Object[] objects = new Object[3];
                var      data    = _curso.getTCursos(Search);

                if (0 < data.Count)
                {
                    var url = Request.Scheme + "://" + Request.Host.Value;
                    objects = new LPaginador <TCursos>().paginador(data, id, Registros, "Cursos", "Cursos", "Cursos", url);
                }
                else
                {
                    objects[0] = "No hay datos que mostrar";
                    objects[1] = "No hay datos que mostrar";
                    objects[2] = new List <TCursos>();
                }


                models = new DataPaginador <TCursos>
                {
                    List            = (List <TCursos>)objects[2],
                    Pagi_info       = (String)objects[0],
                    Pagi_navegacion = (String)objects[1],
                    Categorias      = _lcategoria.getCategoria(),
                    Input           = new TCursos()
                };

                if (identityError != null)
                {
                    models.Pagi_info = identityError.Description;
                    identityError    = null;
                }
                return(View(models));
            }
            else
            {
                return(Redirect("/Home/Index"));
            }
        }
        public IActionResult Index(int id, String filtrar)
        {
            Object[] objects = new Object[3];
            var      data    = _curso.getTCursos(filtrar);

            if (0 < data.Count)
            {
                var url = Request.Scheme + "://" + Request.Host.Value;
                // Visualiza 10 paginas
                // no se pasa ninguna area
                // "Home" nombre del control
                // "Index" nombre de la accion
                // objects = new LPaginador<TCursos>().paginador(data, id, 10, "", "Home", "Index", url);
                objects = new LPaginador <TCursos>().paginador(data, id, 10, "", "Home", "Index", url);
            }
            else
            {
                // si no se obtiene datos
                objects[0] = "No hay datos que mostrar";
                objects[1] = "No hay datos que mostrar";
                objects[2] = new List <TCursos>();
            }

            models = new DataPaginador <TCursos>
            {
                List            = (List <TCursos>)objects[2],
                Pagi_info       = (String)objects[0],
                Pagi_navegacion = (String)objects[1],
                Input           = new TCursos(),
            };

            if (identityError != null)
            {
                // significa que contiene datos
                models.Pagi_info = identityError.Description;
                identityError    = null;
            }
            //await CreateRolesAsync(_serviceProvider);
            return(View(models));
        }