protected override void Apply(ServiceProviderQuickViewVm vm, EntityLocation location) { FormatterResolver.ApplyFormatting <EntityLocation>(vm, typeof(ServiceProviderBlockVm), EntityLocation.ServiceProviderDetails); ServiceProviderDisplayProperties displayProperties = vm.DisplayProperties; Ensure.String(vm.Description, displayProperties.Description, (string i) => vm.Description = i, (bool f) => displayProperties.Description = f); }
protected override void Apply(ServiceProviderShortVm vm, EntityLocation location) { vm.DisplayProperties = vm.DisplayProperties.ServiceProvider(vm.Package, location); ServiceProviderDisplayProperties displayProperties = vm.DisplayProperties; Ensure.Entity <ImageVm>(vm.Image, displayProperties.Image, (ImageVm i) => vm.Image = i, (bool f) => displayProperties.Image = f); Ensure.IntAboveOne(vm.PhotoCount, displayProperties.PhotoCount, (int i) => vm.PhotoCount = i, (bool f) => displayProperties.PhotoCount = f); Ensure.String(vm.Address.Line, displayProperties.Address, (string i) => vm.Address.Line = i, (bool f) => displayProperties.Address = f); Ensure.String(vm.Name, displayProperties.Name, (string i) => vm.Name = i, (bool f) => displayProperties.Name = f); }
protected override void Apply(ServiceProviderDetailsVm vm, PageType location) { FormatterResolver.ApplyFormatting <EntityLocation>(vm.ServiceProvider, typeof(ServiceProviderQuickViewVm), EntityLocation.ServiceProviderDetails); ServiceProviderDisplayProperties displayProperties = vm.ServiceProvider.DisplayProperties; Ensure.String(vm.WebsiteUrl, displayProperties.WebsiteUrl, (string i) => vm.WebsiteUrl = i, (bool f) => displayProperties.WebsiteUrl = f); Ensure.Entity <CouponVm>(vm.Coupon, displayProperties.Coupon, (CouponVm i) => vm.Coupon = i, (bool f) => displayProperties.Coupon = f); Ensure.Collection <string>(vm.PaymentsAccepted, displayProperties.PaymentsAccepted, (bool f) => displayProperties.PaymentsAccepted = f); Ensure.Collection <string>(vm.OfficeHours, displayProperties.OfficeHours, (bool f) => displayProperties.OfficeHours = f); Ensure.Collection <ImageVm>(vm.ServiceProvider.Images, displayProperties.PhotoTour, (bool f) => displayProperties.PhotoTour = f); vm.DisplayProperties = vm.DisplayProperties.ServiceProviderDetails(vm.ServiceProvider.Package); if (vm.FeaturedServices != null) { Ensure.Collection <ServiceProviderShortVm>(vm.FeaturedServices.Items, vm.DisplayProperties.FeaturedProviders, (bool f) => vm.DisplayProperties.FeaturedProviders = f); FormatterResolver.ApplyFormatting <EntityLocation>(vm.FeaturedServices.Items, EntityLocation.FeaturedWidget); } }
protected override void Apply(ServiceProviderBlockVm vm, EntityLocation location) { FormatterResolver.ApplyFormatting <EntityLocation>(vm, typeof(ServiceProviderShortVm), location); ServiceProviderDisplayProperties displayProperties = vm.DisplayProperties; Ensure.String(vm.Phone, displayProperties.Phone, (string i) => vm.Phone = i, (bool f) => displayProperties.Phone = f); Ensure.Collection <County>(vm.CountiesServed, displayProperties.CountiesServed, (bool f) => displayProperties.CountiesServed = f); Ensure.Collection <string>(vm.ServiceCategories, displayProperties.ServiceCategories, (bool f) => displayProperties.ServiceCategories = f); Ensure.Collection <ImageVm>(vm.Images, displayProperties.AdditionalImages, (bool f) => displayProperties.AdditionalImages = f); Ensure.String(vm.SearchRadiusDesignation, displayProperties.RadiusDesignation, (string i) => vm.SearchRadiusDesignation = i, (bool f) => displayProperties.RadiusDesignation = f); Ensure.Boolean(displayProperties.Map, (!displayProperties.Address || !vm.Address.Longitude.HasValue ? false : vm.Address.Latitude.HasValue), (bool i) => { if (!i) { double?nullable = null; vm.Address.Latitude = nullable; nullable = null; vm.Address.Longitude = nullable; displayProperties.Map = false; } }, (bool f) => displayProperties.Map = f); }