Reputation: 67
In normal set up we have:
Controllers/MyController.cs
Views/MyController/Index.cshtml
If I instantiate a model called MyModel
in Index()
of MyController
then in my Index.cshtml
view
if I simply type @model <AppName>.Model.MyModel
, the visual studio knows to get data from Index()
of MyController.cs
class.
My question is how to tell my view to get data from some other Controller class. The view does not have any explicit reference to the controller (something like @model <AppName>.Model.MyModel
= [Get Data from MyController])
I created a controller (has no view) called DataAccessController.cs
. All-access to data from any view must route through this Controller.
Upvotes: 1
Views: 119