Пример #1
0
        public AutoMapperSetup()
        {
            #region "ViewModel To Domain"

            CreateMap <UserRequestCreateAccountViewModel, User>()
            .ForMember(x => x.Password, y => y.MapFrom(m => UtilsService.EncryptPassword(m.Password)));

            #endregion

            #region "Domain to ViewModel"

            CreateMap <User, ContextUserViewModel>()
            .ForMember(x => x.Profile, m => m.MapFrom(map => map.ProfileId));
            CreateMap <User, UserViewModel>();
            CreateMap <User, UserResponseListViewModel>();
            CreateMap <User, UserResponseAuthenticateViewModel>()
            .ForMember(x => x.Profile, m => m.MapFrom(map => map.ProfileId));
            CreateMap <ProfileUser, ProfileViewModel>();
            CreateMap <Module, ModuleViewModel>();

            #endregion
        }