Exemple #1
0
        public static string ArticleTypeUrl(this IUrlHelper helper, Article.Models.ArticleType articleType)
        {
            if (articleType.Url.IsNullOrWhiteSpace())
            {
                return(helper.CategoryUrl(articleType.ID));
            }
            string url             = helper.ActionContext.RouteData.GetPath();
            string currentCategory = helper.ActionContext.RouteData.GetCategoryUrl();

            if (currentCategory != articleType.Url)
            {
                return($"{url}{(url.EndsWith("/") ? "" : "/")}{articleType.Url}");
            }
            else
            {
                return(url);
            }
        }
Exemple #2
0
        public static string ArticleTypeUrl(this IUrlHelper helper, Article.Models.ArticleType articleType)
        {
            if (articleType.Url.IsNullOrWhiteSpace())
            {
                return(helper.CategoryUrl(articleType.ID));
            }
            string path            = helper.ActionContext.RouteData.GetPath();
            string currentCategory = helper.ActionContext.RouteData.GetCategoryUrl();

            if (currentCategory != articleType.Url)
            {
                return($"{path.TrimEnd('/')}/{articleType.Url}");
            }
            else
            {
                return(path);
            }
        }