I don't know whether this is possible or not, but I would like to know if it is and, if so, how it works. So here is my question:
I have 2-3 custom model classes of my own. For example, Customer
,
Employee
and Product
. I also have a class name in a string. Based on the class name, I want to create an instance and return it to a view. How can I achieve this?
I know that one option is an if/else
statement, but I would like a better, dynamic way.