I have a question, can this be done using ASP.NET MVC (Razor, and MapRoute)?
Example
Category/– calls controller Category and Index functionCategory/{State_name}– calls controller Category and Cities(State_id) function, returns all cities inside that state.
So URL is displaying state name , but Cities function receive state id?
Yes u can, try
Let me know if you have any questions or need clarifications on any part.
UPDATE
I have one issue with the way! You get the ID from db with State_name, then get the model from db by State_name! Why not retrieve
model from db by State_name at the first time?
look:
and if you are on EF, then you can create this method:
Why not using this way?