Let us say I have 3 classes A, B and C. B and C inherit from A which contains the string field Name.
I have implemented the controllers As, Bs and Cs for each class. I can list all instances of B and C in a view called Index produced by controller As.
The controllers Bs and Cs also have a method Details which spews out a view given the id for an instance of B and C respectively.
I am wondering about the cleanest way to produce action links for the details pages for B and C objects? I could use GetType() and produce the controller name based on this but this seems a bit cumbersome.
Hope this makes sense. Looking forward to hearing from you. Thanks.
Christian
You could define an extension method on your A class that will return the name of the controller:
Then in your view you could have your link:
This method sort of makes me feel dirty but it works I guess.