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));
        }
Beispiel #2
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"));
            }
        }