/// <summary>
        /// Gets the detail page URL for blog item.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="detailsPageId">The details page identifier.</param>
        /// <param name="blogDetailLocationMode">The blog detail location mode.</param>
        /// <returns></returns>
        public static string GetDetailPageUrl(ItemViewModel item, Guid detailsPageId, BlogDetailLocationMode blogDetailLocationMode)
        {
            string url = null;
            if (blogDetailLocationMode == BlogDetailLocationMode.SelectedExistingPage)
            {
                url = HyperLinkHelpers.GetDetailPageUrl(item.DataItem, detailsPageId);
            }
            else if (blogDetailLocationMode == BlogDetailLocationMode.PerItem)
            {
                var blog = item.DataItem as Blog;

                if (blog != null)
                {
                    var blogPageId = blog.DefaultPageId;

                    if (blogPageId.HasValue)
                        url = HyperLinkHelpers.GetDetailPageUrl(item.DataItem, blogPageId.Value);
                }

            }
            else if (blogDetailLocationMode == BlogDetailLocationMode.SamePage)
            {
                url = DetailLocationHyperLinkHelper.ConstructSamePageUrl(item);
            }

            return url;
        }
示例#2
0
        public static string GetDetailPageUrl(ItemViewModel item, Guid detailsPageId, BlogDetailLocationMode blogDetailLocationMode)
        {
            try
            {
                return(DetailLocationHyperLinkHelper.GetDetailPageUrl(item, detailsPageId, blogDetailLocationMode));
            }
            catch (ArgumentException ex)
            {
                // When the default page is delete, the blog should be rendered as a normal blog without default page.
                if (ex.Message.Contains("Invalid details page"))
                {
                    return(null);
                }

                throw;
            }
        }
示例#3
0
        /// <summary>
        /// Gets the detail page URL for blog item.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="detailsPageId">The details page identifier.</param>
        /// <param name="blogDetailLocationMode">The blog detail location mode.</param>
        /// <returns></returns>
        public static string GetDetailPageUrl(ItemViewModel item, Guid detailsPageId, BlogDetailLocationMode blogDetailLocationMode)
        {
            string url = null;

            if (blogDetailLocationMode == BlogDetailLocationMode.SelectedExistingPage)
            {
                url = HyperLinkHelpers.GetDetailPageUrl(item.DataItem, detailsPageId);
            }
            else if (blogDetailLocationMode == BlogDetailLocationMode.PerItem)
            {
                var blog = item.DataItem as Blog;
                if (blog != null)
                {
                    var blogPageId = blog.DefaultPageId;
                    if (blogPageId.HasValue && blogPageId.Value != Guid.Empty)
                    {
                        url = HyperLinkHelpers.GetDetailPageUrl(item.DataItem, blogPageId.Value);
                    }
                }
            }
            else if (blogDetailLocationMode == BlogDetailLocationMode.SamePage)
            {
                url = DetailLocationHyperLinkHelper.ConstructSamePageUrl(item);
            }

            return(url);
        }