Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static class MyTagHelpers
- {
- public static string Prepare(this IUrlHelper helper, string value)
- {
- if (helper == null)
- throw new ArgumentNullException(nameof(helper));
- if (value.EndsWith("Controller"))
- return value[..^10];
- if (value.EndsWith("Async"))
- return value[..^5];
- return value;
- }
- }
- <form method="post"
- asp-controller="@Url.Prepare(nameof(FooController))"
- asp-action="@Url.Prepare(nameof(FooController.BarsAsync))"></form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement