Exemple #1
0
    protected async Task SetTopicsCount()
    {
        var categories = await manageCategories.GetForumCategoriesAsync();

        foreach (var category in categories)
        {
            var topics = await manageTopics.GetApprovedForumTopicsAsync(category.ForumCategoryId);
            var topicCount = new TopicPostCount
            {
                ParentItemId = category.ForumCategoryId,
                ChildCount = topics.Count
            };
            _topicCountList.Add(topicCount);
        }
    }
Exemple #2
0
        protected async Task SetTopicsCount()
        {
            var topics = await manageForumTopics.GetApprovedForumTopicsAsync(id);

            foreach (var topic in topics)
            {
                var posts = await manageForumPosts.GetApprovedForumPostsAsync(topic.ForumTopicId);

                var postCount = new TopicPostCount
                {
                    ParentItemId = topic.ForumTopicId,
                    ChildCount   = posts.Count
                };
                _postCountList.Add(postCount);
            }
        }
        public async Task <List <TopicPostCount> > GetTopicsPostCountListAsync(List <ForumTopic> forumTopics)
        {
            var postCountList = new List <TopicPostCount>();

            foreach (var topic in forumTopics)
            {
                var posts = await _manageForumPosts.GetApprovedForumPostsAsync(topic.ForumTopicId);

                var postCount = new TopicPostCount
                {
                    ParentItemId = topic.ForumTopicId,
                    ChildCount   = posts.Count
                };
                postCountList.Add(postCount);
            }
            return(postCountList);
        }