private static ServiceProviderBlockVm MapToServiceProviderBlockVm(this ServiceProvider serviceProvider, ServiceProviderBlockVm viewModel) { ServiceProviderBlockVm serviceProviderShortVm = serviceProvider.MapToServiceProviderShortVm(viewModel ?? new ServiceProviderBlockVm()) as ServiceProviderBlockVm; if (serviceProviderShortVm != null) { serviceProviderShortVm.Description = serviceProvider.Description; serviceProviderShortVm.CountiesServed = serviceProvider.CountiesServed; serviceProviderShortVm.ServiceCategories = serviceProvider.ServiceCategories; serviceProviderShortVm.Images = (serviceProvider.Images.Any <Image>((Image i) => i.Type == ImageType.Image) ? ( from i in serviceProvider.Images where i.Type == ImageType.Image select i).ToList <Image>().ConvertAll <ImageVm>((Image i) => i.MapToImageVm(ImageOwner.Service, serviceProviderShortVm.Name)) : new List <ImageVm>()); serviceProviderShortVm.Phone = serviceProvider.Phone; serviceProviderShortVm.SearchRadiusDesignation = (serviceProvider.SearchResultRadius > 0 ? string.Format(StaticContent.Txt_SearchRadiusDesignation, serviceProvider.SearchResultRadius) : string.Empty); serviceProviderShortVm.PrintUrl = MslcUrlBuilder.PrintUrl(serviceProvider); serviceProviderShortVm.PrintDirectionBaseUrl = MslcUrlBuilder.PrintDirectionBaseUrl(serviceProvider); } return(serviceProviderShortVm); }
private static CommunityBlockVm MapToCommunityBlockVm(this Community community, SearchType searchType, CommunityBlockVm viewModel) { CommunityBlockVm communityShortVm = community.MapToCommunityShortVm(searchType, viewModel ?? new CommunityBlockVm()) as CommunityBlockVm; if (communityShortVm != null) { communityShortVm.Description = community.Description; communityShortVm.ListingTypes = community.ListingTypes; communityShortVm.Bathes = community.Bathes.BathesCaption(); communityShortVm.Beds = community.Beds.BedsCaption(); communityShortVm.Area = community.LivingSpace.AreaCaption(); communityShortVm.Amenities = community.Amenities; communityShortVm.Images = (community.Images.Any <Image>((Image i) => i.Type == ImageType.Image) ? ( from i in community.Images where i.Type == ImageType.Image select i).ToList <Image>().ConvertAll <ImageVm>((Image i) => i.MapToImageVm(ImageOwner.Community, communityShortVm.Name)) : new List <ImageVm>()); communityShortVm.Phone = community.Phone; communityShortVm.SearchRadiusDesignation = (community.SearchResultRadius > 0 ? string.Format(StaticContent.Txt_SearchRadiusDesignation, community.SearchResultRadius) : string.Empty); communityShortVm.PrintUrl = MslcUrlBuilder.PrintUrl(community, searchType); communityShortVm.PrintDirectionBaseUrl = MslcUrlBuilder.PrintDirectionBaseUrl(community, searchType); communityShortVm.SHC = community.ShcCategories; } return(communityShortVm); }