コード例 #1
0
        // GET: Home
        public ActionResult Index()
        {
            var list = new InitPagerDate().GetPagerDate;

            ViewBag.TotalRecord = list.Count();//总记录


            return(View(list));
        }
コード例 #2
0
        // GET: Pager
        public ActionResult PagerDemo1()
        {
            var list = new InitPagerDate().GetPagerDate;

            ViewBag.TotalRecord = list.Count();                             //总记录
            ViewBag.PageCount   = Math.Ceiling(list.Count * 0.1 / 10) * 10; //总页数
            //var page = list.OrderBy(x => x.Id).Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList();
            //if (Request.IsAjaxRequest())
            //{
            //    return PartialView("_Pager", page);
            //}
            return(View(list));
        }
コード例 #3
0
        // vue分页
        public ActionResult Index(int pageIndex = 1, int pageSize = 10)
        {
            var list = new InitPagerDate().GetPagerDate;

            ViewBag.TotalRecord = list.Count();                             //总记录
            ViewBag.PageCount   = Math.Ceiling(list.Count * 0.1 / 10) * 10; //总页数
            var page = list.OrderBy(x => x.Id).Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList();
            Dictionary <string, List <PagerDemo> > dic = new Dictionary <string, List <PagerDemo> >();

            dic.Add("Items", page);
            var json = JsonConvert.SerializeObject(dic);

            ViewBag.json = json;
            if (Request.IsAjaxRequest())
            {
                return(Json(json));
            }
            return(View());
        }