Exemplo n.º 1
0
        public async Task <IActionResult> GetForumThreads([FromQuery] ForumThreadsParams forumThreadsParams)
        {
            var forumThreads = await context.GetAllForumThreads(forumThreadsParams);

            Response.AddPagination(forumThreads.CurrentPage, forumThreads.PageSize, forumThreads.TotalCount,
                                   forumThreads.TotalPages);

            return(Ok(mapper.Map <IEnumerable <ForumThreadPreviewDto> >(forumThreads)));
        }
Exemplo n.º 2
0
        public async Task <PagedList <ForumThread> > GetAllForumThreads(ForumThreadsParams forumThreadsParams)
        {
            var forumThreads = context
                               .ForumThreads
                               .Include(t => t.Author)
                               .AsQueryable();

            return(await PagedList <ForumThread> .CreateAsync(forumThreads, forumThreadsParams.PageNumber,
                                                              forumThreadsParams.PageSize));
        }