示例#1
0
        protected override void OnCulturedSaveChanged(CityParams entityParams)
        {
            base.OnSaveChanged(entityParams);

            if (entityParams == null)
            {
                return;
            }

            var config = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <CityParams, CustomRouteParams>()
                .ForMember(src => src.Id, dest => dest.Ignore());
            });

            var mapper = config.CreateMapper();

            var customRouteParams = mapper.Map <CityParams, CustomRouteParams>(entityParams);

            customRouteParams.PredefinedPage = PredefinedPage.City;
            customRouteParams.ContentId      = entityParams.Id;
            customRouteParams.UrlParts       = entityParams.Name.Split(' ');
            _customRouteService.CreateOrUpdate(customRouteParams);
        }