Skip to content

Instantly share code, notes, and snippets.

@scottsauber
Created June 20, 2018 01:39
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save scottsauber/fe12d9341463e16ee6fe9fefb32c88b1 to your computer and use it in GitHub Desktop.
Save scottsauber/fe12d9341463e16ee6fe9fefb32c88b1 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