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")); }
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); }
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); }
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); } }
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); } }
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()}"); }