public UserAgentRedirectEdit BuildEditModelForUserAgentRedirectPart(UserAgentRedirectPart part)
        {
            Mapper.Initialize(cfg => {
                cfg.CreateMap <AppStoreRedirectRecord, AppStoreEdit>();
                cfg.CreateMap <UserAgentRedirectPart, UserAgentRedirectEdit>()
                .ForMember(dest => dest.Stores, opt => opt.MapFrom(src => src.Stores));
            });
            var viewModel = Mapper.Map <UserAgentRedirectEdit>(part);

            return(viewModel);
        }
Пример #2
0
        public UserAgentRedirectEdit BuildEditModelForUserAgentRedirectPart(UserAgentRedirectPart part)
        {
            var mapperConfiguration = new MapperConfiguration(cfg => {
                cfg.CreateMap <AppStoreRedirectRecord, AppStoreEdit>();
                cfg.CreateMap <UserAgentRedirectPart, UserAgentRedirectEdit>()
                .ForMember(dest => dest.Stores, opt => opt.MapFrom(src => src.Stores));
            });
            IMapper _mapper = mapperConfiguration.CreateMapper();

            var viewModel = _mapper.Map <UserAgentRedirectEdit>(part);

            return(viewModel);
        }