public async Task LoadPostsAsync() { Posts = await _manageForumPosts.GetApprovedForumPostsAsync(Id); if (MaxCount >= Posts.Count) { LoadMoreVisibility = "d-none"; } Posts = Posts.Take(MaxCount).ToList(); await new ForumUserHelpers(_manageUsers).AddUserToPostAsync(Posts); }
public async Task LoadPostsAsync(int id) { var posts = await _manageForumPosts.GetApprovedForumPostsAsync(id); await new ForumUserHelpers(_manageUsers).AddUserToPostAsync(posts); List <Models.ForumPost> currentPosts; var topicHasPosts = PostsDictionary.TryGetValue(id, out currentPosts); if (topicHasPosts) { PostsDictionary.TryUpdate(id, posts, currentPosts); } else { PostsDictionary.TryAdd(id, posts); } }
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); }