I'm having a challenge figuring out the best way to define my hierarchical based routes dynamically.
I'm looking to achieve database driven links similar to the below:
/Illinois/
/Illinois/Chicago/
/Illinois/Chicago/Id
/California/
/California/Los-Angeles/
/California/Los-Angeles/Id
/New-York/
/New-York/New-York-City/
/New-York/New-York-City/Id
And so on, I don't want to have to define a controller for each state, but I'm not 100% against if if it's "the right way".
You can create a controller like
HomeController
and use route attributes on the top of this controller and related action to hide the route url and call your locations and ids in route like this: