public IActionResult Index(int page, string search)
        {
            Object[] objects = new Object[3];
            var      data    = _lcourse.GetListCourses(search);

            if (data.Count > 0)
            {
                var url = Request.Scheme + "://" + Request.Host.Value;
                objects = new LPager <TCourse>().Pager(data, page, 5, "", "Home", "Index", url);
            }
            else
            {
                objects[0] = "No data";
                objects[1] = "No data";
                objects[2] = new List <TCourse>();
            }

            model = new DataPager <TCourse>
            {
                List      = (List <TCourse>)objects[2],
                Page_info = (string)objects[0],
                Page_nav  = (string)objects[1],
                Input     = new TCourse()
            };
            if (_identityError != null)
            {
                model.Page_info = _identityError.Description;
                _identityError  = null;
            }

            //await CreateRolesAsync(_serviceprovider);
            return(View(model));
        }
        public async Task <IActionResult> Index(int page, string search, int records)
        {
            if (_signinManager.IsSignedIn(User))
            {
                object[] objects = new object[3];
                var      user    = await _userManager.GetUserAsync(User);

                var userID = await _userManager.GetUserIdAsync(user);

                var data = _lCourse.Inscriptions(userID, search);
                if (data.Count > 0)
                {
                    var url = Request.Scheme + "://" + Request.Host.Value;
                    objects = new LPager <DataCourse>().Pager(data, page, records, "Inscriptions", "Inscriptions", "Index", url);
                }
                else
                {
                    objects[0] = "No Data";
                    objects[1] = "No Data";
                    objects[2] = new List <DataCourse>();
                }
                model = new DataPager <DataCourse>
                {
                    Page_info = (string)objects[0],
                    Page_nav  = (string)objects[1],
                    List      = (List <DataCourse>)objects[2],
                    Input     = new DataCourse()
                };
                return(View(model));
            }
            else
            {
                return(Redirect("/Home/Index"));
            }
        }
        public IActionResult Index(int id, string Search, int Records)
        {
            if (_signInManager.IsSignedIn(User))
            {
                object[] objects = new object[3];
                var      data    = _lcareer.getTCareer(Search);
                if (data.Count > 0)
                {
                    var url = Request.Scheme + "://" + Request.Host.Value;
                    objects = new LPager <TCareer>().Pager(_lcareer.getTCareer(Search), id, Records, "Career", "Careers", "Index", url);
                }
                else
                {
                    objects[0] = "No Data";
                    objects[1] = "No Data";
                    objects[2] = new List <TCareer>();
                }

                models = new DataPager <TCareer>
                {
                    List      = (List <TCareer>)objects[2],
                    Page_info = (string)objects[0],
                    Page_nav  = (string)objects[1],
                    Input     = new TCareer()
                };
                return(View(models));
            }
            else
            {
                return(RedirectToAction(nameof(HomeController.Index), "Index"));
            }
        }
예제 #4
0
        public IActionResult Index(int id, string search, int records)
        {
            if (_signInManager.IsSignedIn(User))
            {
                object[] objects = new object[3];
                var      data    = _lcourse.GetListCourses(search);
                if (data.Count > 0)
                {
                    var url = Request.Scheme + "://" + Request.Host.Value;
                    objects = new LPager <TCourse>().Pager(data, id, records, "Course", "Courses", "Index", url);
                }
                else
                {
                    objects[0] = "No Data";
                    objects[1] = "No Data";
                    objects[2] = new List <TCourse>();
                }

                models = new DataPager <TCourse>
                {
                    List      = (List <TCourse>)objects[2],
                    Page_info = (string)objects[0],
                    Page_nav  = (string)objects[1],
                    Careers   = _lcareer.GetListCareer(),
                    //Professors = _lcourse.GetListProfessor(),
                    Input = new TCourse()
                };
                return(View(models));
            }
            else
            {
                return(RedirectToAction("/Home/Index"));
            }
        }