That is one of the reasons why a view model is used, a view model is a model which should be used exclusively to encapsulate data that will be sent to the view. So instead of you sending one model directly to the view, you encapsulate him inside a view model along with other data you want to view have access.
In your case, what could be done is the following, you would create a class inside the folder /Models
of your project following the [NomeDaViewOndeSeráUtilizada]ViewModel
and within this class you would create a property for each of these models. Take an example:
public class IndexViewModel
{
public Pessoa Pessoa { get; set; }
public Fisica Fisica { get; set; }
public Juridica Juridica { get; set; }
}
And the action who would return this view model could turn out like this:
public ActionResult Index()
{
var viewModel = new IndexViewModel();
// Preencha as propriedades do objeto viewModel como desejar
// e o retorne para a view
return View(viewModel);
}
I know more the Webforms and had is doubtful too. I could say that another way would be using partialView?
– Marconi
@Marconi yes, another way could be using a partial view, but the situation would have to be analyzed further, this because a partial view is generally used to avoid code repetition, i.e., a partial view will usually be used in more than one place in the application, and another point worth noting is that you will still need to send a model to the partial view as one of the parameters to call it from within your view and this model can be obtained through view model of view or manually unstable from within the view.
– Zignd
Okay, thank you. Good answer.
– Marconi
Thanks @Zignd, it worked perfectly!
– Furlan