Skip to content

Instantly share code, notes, and snippets.

@JustCallMeAD
Forked from scottsauber/AdministratorPages.cs
Created August 17, 2018 15:06
Show Gist options
  • Save JustCallMeAD/043dab828aad1e21f27c9e4cf7a133cd to your computer and use it in GitHub Desktop.
Save JustCallMeAD/043dab828aad1e21f27c9e4cf7a133cd to your computer and use it in GitHub Desktop.
// Pages constants class
public class AdministratorPages
{
public const string Base = "/Administrator";
public static string Index = $"{Base}/Index";
public static string EmployeesIndex = $"{Base}/Employees/Index";
}
// Usage in a View
<a asp-page="@AdministratorPages.Index">Administrator Home Page</a>
// Usage in a PageModel for Redirects
public IActionResult OnPost()
{
// Do something
return RedirectToPage(AdministratorPages.Index);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment