0
I’m having a problem converting a List for ViewModel, using the ToListViewModel.
Faturacontroller.Cs
FaturaViewModel faturaViewModel = new FaturaViewModel();
faturaViewModel.mensagens = new List<MensagemViewModel>();
faturaViewModel.mensagens = this.ToListViewModel<Mensagem, MensagemViewModel>(_MensagemApplicationService.GetAllAsNoTracking().ToList());
return View(faturaViewModel);
The Model and the ViewModel has the same fields.
Faturaviewmodel.Cs
public List<MensagemViewModel> mensagens { get; set; }
Exception
System.Exception: 'Error mapping types.
Mapping types:
ICollection`1 -> List`1
System.Collections.Generic.ICollection`1
						
Possible duplicate of Asp.net c# DDD - problem when passing data from Entity to Viewmodel
– Barbetta