Пример #1
0
        /// <summary>
        /// Gets the blog ID for the requested blog
        /// </summary>
        /// <param name="blogName">Name of the requested blog for which to retrieve the ID for</param>
        /// <returns>The unique identifier for the blog</returns>
        /// <exception cref="InvalidOperationException">If <paramref name="blogName"/> is null or empty</exception>
        public static Guid GetBlogId(string blogName)
        {
            Guid blogId;

            if (String.IsNullOrEmpty(blogName))
            {
                throw new InvalidOperationException("blogName cannot be null or empty");
            }

            using (IDataRepository<Blog> repository = new DataRepository<Blog>())
            {
                blogId = repository.GetSingle(b => b.FriendlyName == blogName).BlogId;
            }

            return blogId;
        }
Пример #2
0
        /// <summary>
        /// Gets the default page size for a blog
        /// </summary>
        /// <param name="blogName">>Name of the requested blog for which to retrieve the page size for</param>
        /// <returns>The default page size for a blog</returns>
        public static int GetPageSize(string blogName)
        {
            int pageSize;

            if (String.IsNullOrEmpty(blogName))
            {
                throw new InvalidOperationException("blogName cannot be null or empty");
            }

            using (IDataRepository<Blog> repository = new DataRepository<Blog>())
            {
                pageSize = repository.GetSingle(b => b.FriendlyName == blogName).MaxHomePagePosts;
            }

            return pageSize;
        }