What am i doing wrong? I added a Files field for Organization in CustomerArea but my mapping isn’t working. I saw how Litiums demo and it does the same thing for Article Page but the mapping is created from PageModel.
How can i get correct mapping to show my organization files to MyPages view. Thanks in advanced.
public IList<FileModel> OrganizationFiles { get; set; }
[UsedImplicitly]
void IAutoMapperConfiguration.Configure(IMapperConfigurationExpression cfg)
{
cfg.CreateMap<PageModel, BusinessCustomerDetailsViewModel>();
cfg.CreateMap<Person, BusinessCustomerDetailsViewModel>()
.ForMember(x => x.CustomerNumber, m => m.MapFrom(person => person.Id))
.ReverseMap();
cfg.CreateMap<Organization, BusinessCustomerDetailsViewModel>()
.ForMember(x => x.OrganizationNumber, m => m.MapFrom(organization => organization.Id))
.ForMember(x => x.OrganizationName, m => m.MapFrom(organization => organization.Name))
.ForMember(x => x.OrganizationFiles, m => m.MapFrom(files => files.Fields.GetValue<IList<Guid>>(GcCustomerNameConstants.OrganizationFiles)
.Select(x => x.MapTo<FileModel>())));
}
Unable to cast object of type ‘System.Collections.ObjectModel.ReadOnlyCollection1[Litium.FieldFramework.FieldTypes.PointerItem]' to type 'System.Collections.Generic.IList
1[System.Guid]’.
Litium version: 7.2