-4
Good afternoon, everyone,
I have an MVC application and I need a view to access two models. The models are:
And each model has its controller, where I connect to Webservice to bring the data from another application.
I need that in the Project view I can also use the model Detail Model, how can I do this? I’m new to MVC so I’m having a hard time getting it done...
Create a Viewmodel that contains your two models
– Leandro Angelo
You can use partial views.
– Maycon F. Castro
Take it easy, first the actions are the same image. Second, it is not possible to call two action, you will need to use a Partial View or make a service layer.
– Gabriel Coletta
First thing is to post the code in text and remove the images.
– Jéf Bueno
Related: https://answall.com/questions/110056/view-com-2-model-dentro-de-uma-viewmodel
– novic
Conceptually a view should link with a single controller. You can even do mirabolisms like the one you suggest, but it’s a one-way street, you start building problems above you and you get deeper and deeper. At the end your application has two paths works and will never receive maintenance (unviable) or does not work and your work will have been useless.
– Diego Rafael Souza