Esempio n. 1
0
 public static string PostUrl(this IUrlHelper helper, string url, string id)
 {
     if (url.IsNullOrWhiteSpace())
     {
         url = "/";
     }
     return(helper.Content($"{url}{(url.EndsWith("/") ? "" : "/")}{StringKeys.PathFormat(StringKeys.RouteValue_Post)}{id}.html"));
 }
Esempio n. 2
0
 public static string PostUrl(this IUrlHelper helper, string url, string id)
 {
     if (url.IsNullOrWhiteSpace())
     {
         url = "/";
     }
     return(url + (url.EndsWith("/") ? "" : "/") + StringKeys.PathFormat(StringKeys.RouteValue_Post) + id);
 }
Esempio n. 3
0
        public static string Page(this IUrlHelper helper, int pageIndex)
        {
            var category = helper.ActionContext.RouteData.GetCategory();

            if (category > 0)
            {
                return(helper.ActionContext.RouteData.GetPath() +
                       "/" + StringKeys.PathFormat(StringKeys.RouteValue_Category) + category +
                       "/" + StringKeys.PathFormat(StringKeys.RouteValue_Page) + pageIndex);
            }
            return(helper.ActionContext.RouteData.GetPath() + "/" + StringKeys.PathFormat(StringKeys.RouteValue_Page) + pageIndex);
        }
Esempio n. 4
0
        public static string CategoryUrl(this IUrlHelper helper, string id)
        {
            string url             = helper.ActionContext.RouteData.GetPath();
            string currentCategory = helper.ActionContext.RouteData.GetCategory().ToString();

            if (currentCategory != id)
            {
                return($"{url}{(url.EndsWith("/") ? "" : "/")}{StringKeys.PathFormat(StringKeys.RouteValue_Category)}{id}");
            }
            else
            {
                return(url);
            }
        }
Esempio n. 5
0
        public static string CategoryUrl(this IUrlHelper helper, string id)
        {
            string path            = helper.ActionContext.RouteData.GetPath();
            string currentCategory = helper.ActionContext.RouteData.GetCategory().ToString();

            if (currentCategory != id)
            {
                return($"{path.TrimEnd('/')}/{StringKeys.PathFormat(StringKeys.RouteValue_Category)}{id}");
            }
            else
            {
                return(path);
            }
        }
Esempio n. 6
0
        public static string Page(this IUrlHelper helper, int pageIndex)
        {
            var category = helper.ActionContext.RouteData.GetCategory();

            if (category > 0)
            {
                if (pageIndex > 0)
                {
                    return($"{helper.ActionContext.RouteData.GetPath()}/{helper.ActionContext.RouteData.GetCategoryUrl() ?? (StringKeys.PathFormat(StringKeys.RouteValue_Category) + category)}/{StringKeys.PathFormat(StringKeys.RouteValue_Page)}{pageIndex}");
                }
                else
                {
                    return($"{helper.ActionContext.RouteData.GetPath()}/{helper.ActionContext.RouteData.GetCategoryUrl() ?? (StringKeys.PathFormat(StringKeys.RouteValue_Category) + category)}");
                }
            }
            if (pageIndex > 0)
            {
                return($"{helper.ActionContext.RouteData.GetPath()}/{StringKeys.PathFormat(StringKeys.RouteValue_Page)}{pageIndex}");
            }
            return($"{helper.ActionContext.RouteData.GetPath()}");
        }