Example #1
0
        public async Task <IActionResult> Index()
        {
            var posts = await m_postService.PagePostsAsync(null, 1, 2, false);

            var model = new PagedPostsViewModel
            {
                Posts    = PostViewModel.Build(posts),
                Page     = 1,
                PageSize = 2,
                Cursor   = posts.FirstOrDefault()?.Id
            };

            return(View("~/Views/Posts/Index", model));
        }
Example #2
0
        public async Task <IActionResult> Index(
            string cursor = null,
            int page      = 1,
            int pageSize  = 20)
        {
            var posts = await m_postService.PagePostsAsync(cursor, page, pageSize, false);

            var model = new PagedPostsViewModel
            {
                Posts    = PostViewModel.Build(posts),
                Page     = page,
                PageSize = pageSize,
                Cursor   = cursor ?? posts.FirstOrDefault()?.Id
            };

            return(View(model));
        }