How can I create a generic view model in MVC?
-
12-11-2019 - |
Question
I would like to use a viewmodel in MVC instead of using viewbag. Is there a way that I could create some generic viewmodel that's shared between all my controllers and then use this in my views? What kind of code would I need for this? I was thinking to maybe create something in a base controller. Is that possible?
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow