// localhost:9000/api/forumtitle?skip=0&take=10&sortBy=LastModified&orderBy=Asc public async Task<Pagination<ThreadPostTitleDTO>> Get(int skip, int take, ForumSortBy sortBy = ForumSortBy.CreatedOn, ForumOrderBy orderBy = ForumOrderBy.Desc) { try { logger.Debug("Class: ForumTitleRepository, Method: Get, BEGIN"); var titles = await threadTitleRepository.GetPage(skip, take, () => sortBy.ToString(), () => orderBy.ToString()); var titleDtos = titles.CurrentItems.Select(t => { var commentCount = forumCommentRepository.Count(t.ThreadID); Comment latest = null; if (t.LatestComment.HasValue) { latest = forumCommentRepository.GetSingleByID(t.LatestComment.Value).Result.ValueOr(alternative: null); } return Converters.ToThreadPostTitleDTO(t, latest, commentCount.Result); }); logger.Debug("Class: ForumTitleRepository, Method: Get, END"); return new Pagination<ThreadPostTitleDTO> { CurrentItems = titleDtos.ToList(), CurrentPage = titles.CurrentPage, TotalPages = titles.TotalPages }; } catch (System.Exception ex) { logger.Error(ex); throw; } }
public ForumModule(ISessionManager sessionManager) { _sessionManager = sessionManager; this._currentAction = ForumModuleAction.ForumList; _categorySortBy = CategorySortBy.Name; _forumSortBy = ForumSortBy.Name; _forumPostSortBy = ForumPostSortBy.DateCreated; _categorySortASC = true; _forumSortASC = true; _forumPostSortASC = true; this._forumthemepath = UrlHelper.GetApplicationPath() + "Modules/Forum/Images/Standard/"; }