/// <summary> /// Returns a list of all sub categories within a parent category /// </summary> /// <param name="categoryNodeId"></param> /// <returns></returns> public IEnumerable<ForumCategory> ReturnAllSubCategoriesInCategory_NodeFactory(int categoryNodeId) { var subCategories = new Node(categoryNodeId).ChildrenAsList.Where(x => x.NodeTypeAlias == NodeTypeCategory).OrderBy(x => x.SortOrder); return subCategories.Select(searchResult => Mapper.MapForumCategory(searchResult)); }
/// <summary> /// Returns the sum of all votes for all posts within a topic /// </summary> /// <param name="topicNodeId"></param> /// <returns></returns> public int ReturnSumOfVotesInTopic_NodeFactory(int topicNodeId) { var posts = new Node(topicNodeId).ChildrenAsList.Where(x => x.NodeTypeAlias == NodeTypePost); return posts.Select(searchResult => searchResult.GetProperty("forumPostKarma").Value.ToInt32()).Sum(); }
/// <summary> /// Returns a list of posts from a parent topic /// </summary> /// <param name="topicNodeId"></param> /// <returns></returns> public IEnumerable<ForumPost> ReturnAllPostsInTopic_NodeFactory(int topicNodeId) { var posts = new Node(topicNodeId).ChildrenAsList.Where(x => x.NodeTypeAlias == NodeTypePost).OrderBy(x => x.CreateDate); return posts.Select(searchResult => Mapper.MapForumPost(searchResult)); }