I have several controller and views, I want to pass view model and partial view model to the view and a partial view (display some debug information) which is rendered in the shared layout view.
option 1 which I believe it is working but I'm not sure if it is good approach(Please confirm).
Create layout view model and include all the other view models for different views and the view model for the partial view.
Public class layout
{
public PartialViewModel A;
public ViewModel B
public ViewModel C
.....(depends on how many view models I have)
}
Define the layout view model in shared layout view pass the partial view model to partial view. In controller get and post action initialize the Layout view and pass the layout view along.
Option 2 I don't know how it would work, but if it works, that would be cool In each view model, I will define the partial view model in it. I will pass the view model and partial view model along, but in the shared layout view, how can I pass the partial view model to the partial view?
Thanks