示例#1
0
        public async Task <ActionResult> AritcleList2(int pageIndex = 1, int pageSize = 7)
        {
            //需要给页面前端 总页面数,当前页面,可显示的总页面数
            var articleMgr = new ArticleManager();
            var userId     = Guid.Parse(Session["userId"].ToString());
            //当前用户第n页数据
            var articles = await articleMgr.GetAllArticlesByuserId(userId, pageIndex - 1, pageSize);

            //获取当前文章总数
            var dataCount = await articleMgr.GetDataCount(userId);

            return(View(new PagedList <BlogSystem.Dto.ArticleDto>(articles, pageIndex, pageSize, dataCount)));
        }
示例#2
0
        public async Task <ActionResult> AritcleList(int pageIndex = 0, int pagesize = 1)
        {
            //需要给页面前端 总页面数,当前页面,可显示的总页面数
            var articleMgr = new ArticleManager();
            var userId     = Guid.Parse(Session["userId"].ToString());
            var articles   = await articleMgr.GetAllArticlesByuserId(userId, pageIndex, pagesize);

            var dataCount = await articleMgr.GetDataCount(userId);

            ViewBag.PageCount = dataCount % pagesize == 0 ? dataCount / pagesize : dataCount / pagesize + 1;
            ViewBag.PageIndex = pageIndex;
            return(View(articles));
        }