Esempio n. 1
0
        public IActionResult ResultIndex(int PageIndex = 1, int PageSize = 2)
        {
            var result = _resultDao.GetResultListAsync();
            //分页
            int           count          = 0;
            List <Result> result1        = _resultDao.PageResultList(PageIndex, PageSize, out count);
            int           countPageIndex = count % 5 == 0 ? count / PageSize : count / PageSize + 1;

            int startPageIndex = PageIndex - 2 > 0 ? PageIndex - 2 : 1;
            int endPageIndex   = startPageIndex + 2 >= countPageIndex ? countPageIndex : startPageIndex + 4 > countPageIndex ? countPageIndex : startPageIndex + 3;


            ViewBag.startPageIndex = startPageIndex;
            ViewBag.endPageIndex   = endPageIndex;
            return(View(result1));
        }
Esempio n. 2
0
        public IActionResult PageList(int PageIndex = 1, int PageSize = 3)
        {
            var result = _resultDao.PageResultList(PageIndex, PageSize, out int count);
            //将result实体转换成APIResultModel实体
            var dataValues = result.Select(r => new APIResultModel()
            {
                Id         = r.Id,
                StuName    = r.StuName,
                PassWord   = r.PassWord,
                FilePath   = r.FilePath,
                Title      = r.Title,
                Discrption = r.Discrption,
                Type       = r.Type.Name
            });

            return(Ok(dataValues));
        }