Пример #1
0
        public UserProfile()
        {
            CreateMap <RegisterModel, User>()
            .ForMember(x => x.Password, opt => opt.MapFrom(src => CryptoProvider.HashPassword(src.Password)))
            .ForMember(x => x.Role, opt => opt.Ignore());

            CreateMap <User, UserModel>()
            .ForMember(x => x.Role, opt => opt.MapFrom(src => src.Role.Name));

            CreateMap <User, UserInfo>();

            CreateMap <Role, RoleDto>();
        }