コード例 #1
0
ファイル: Categories.cs プロジェクト: mfcharaf/SnitzDotNet
        public static IEnumerable <ForumInfo> GetCategoryForums(int categoryid, MemberInfo member)
        {
            IForum dal = Factory <IForum> .Create("Forum");

            var allowedforums = Forums.AllowedForums(member);

            if (member == null)
            {
                allowedforums = Forums.ViewableForums();
            }
            return(dal.GetByParent(categoryid).Where(catforum => allowedforums.Contains(catforum.Id)));
        }
コード例 #2
0
        /// <summary>
        /// A method to search forums by category id
        /// </summary>
        /// <param name="categoryId">The category id to search by</param>
        /// <param name="startrec"></param>
        /// <param name="maxrecs"></param>
        /// <returns>An interface to an arraylist of the search results</returns>
        public static IEnumerable <ForumInfo> GetForumsByCategory(int categoryId, int startrec, int maxrecs)
        {
            // Return null if the string is empty
            if (categoryId < 1)
            {
                return(null);
            }

            // Get an instance of the Product DAL using the DALFactory
            IForum dal = Factory <IForum> .Create("Forum");

            // Run a search against the data store
            return(dal.GetByParent(categoryId));
        }