i have to model and viewModel like this
public class Estate:BaseEntity
{
public virtual BaseInformation floorType { get; set; }
}
public class EstateViewModel:BaseEntityViewModel
{
public long floorType { get; set; }
}
and i wrote the code in controller like this :
[HttpPost]
public long save(EstateViewModel estateViewModel)
{
Estate entity = new Estate();
BaseInformation bi = new BaseInformation();
bi.id = 1;
entity.floorType = bi;
EstateViewModel ev = new EstateViewModel();
Mapper.CreateMap<EstateViewModel, Estate>();
var model = AutoMapper.Mapper.Map<EstateViewModel,Estate>(estateViewModel);
return estateRepository.save(entity);
}
when call the action autoMapper give an error like this : An exception of type 'AutoMapper.AutoMapperMappingException' occurred in AutoMapper.dll but was not handled in user code
please help how can fix it thanks
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire