Skip to content

Instantly share code, notes, and snippets.

@skttl
Created June 7, 2023 08:31
Show Gist options
  • Save skttl/c77cbc26828493f6a6b56b4ef6d8c578 to your computer and use it in GitHub Desktop.
Save skttl/c77cbc26828493f6a6b56b4ef6d8c578 to your computer and use it in GitHub Desktop.
using Umbraco.Cms.Web.Website.Controllers;
namespace Ecreo.Essentials.Helpers;
public static class UrlHelperExtensions
{
public static string? Action<T>(this IUrlHelper Url, string name) where T : SurfaceController
{
return Url.Action<T>(name, null, null, null, null);
}
public static string? Action<T>(this IUrlHelper Url, string name, object? values) where T : SurfaceController
{
return Url.Action<T>(name, values, null, null, null);
}
public static string? Action<T>(this IUrlHelper Url, string name, object? values, string? protocol) where T : SurfaceController
{
return Url.Action<T>(name, values, protocol, null, null);
}
public static string? Action<T>(this IUrlHelper Url, string name, object? values, string? protocol, string? host) where T : SurfaceController
{
return Url.Action<T>(name, values, protocol, host, null);
}
public static string? Action<T>(this IUrlHelper Url, string name, object? values, string? protocol, string? host, string? fragment) where T : SurfaceController
{
return Url.Action(name, ControllerExtensions.GetControllerName(typeof(T)), values, protocol, host, fragment);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment