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))); }
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)); }