A view using two MVC models [duplicate]

-4

Good afternoon guys,

I have an application in MVC and I need a view to access two models. The models are:

Andeachmodelhasitscontroller,whereIconnecttotheWebServicetobringthedatafromanotherapplication.

I need that in the Project view I can also use the DetailPrjModel model, how can I do this? I'm new to MVC so I'm having a hard time getting this done ...

    
asked by anonymous 14.02.2018 / 20:01

1 answer

1

Just create a ViewModel with both models

public class DetalheProjetoViewModel
{
    public ProjetoModel Projeto { get; set; }
    public DetalhePrjModel Detalhe { get; set; }
}

and then switch to view

@model DetalheProjetoViewModel
    
14.02.2018 / 20:06