your view:
public class FornecedorViewModel
{
public FornecedorViewModel()
{
FornecedorEmails = new List<FornecedorEmailsViewModel>();
FornecedorTelefones = new List<FornecedorTelefonesViewModel>();
FornecedorEnderecos = new List<FornecedorEnderecosViewModel>();
}
//suas outras props aqui..
public virtual IEnumerable<FornecedorEmailsViewModel> FornecedorEmails { get; set; }
public virtual IEnumerable<FornecedorTelefonesViewModel> FornecedorTelefones { get; set; }
public virtual IEnumerable<FornecedorEnderecosViewModel> FornecedorEnderecos { get; set; }
}
for the listing screen, if the screen is only a list of forencers, you should type your view as follows:
@model IEnumerable<FornecedorViewModel>
for screens where you need only 1 Vendor, but with its child attributes, type as below:
@model FornecedorViewModel
It is worth mentioning that the differential will be where you take the data (in this case a repository). You must bring only Vendor data on the listing screen, while on the other, you must bring the results of Vendor and its child classes.
To access Vendor’s child properties in your view, simply call Model (with a capital M) and from there, you will navigate to any daughter entity. Example:
@Model.FornecedorEmails
Note: this is just a view. You can implement in N different ways.
Only with this it is difficult to answer, it seems to me that it is the case for a view only and does not have to call any other, but it depends on the UI you want, the intended UX.
– Maniero