コード例 #1
0
        internal static CommunityBlockVm MapToCommunityBlockVm(this Community community, SearchType searchType)
        {
            CommunityBlockVm communityBlockVm = community.MapToCommunityBlockVm(searchType, null);

            communityBlockVm.Amenities = communityBlockVm.Amenities.Take <string>(SearchExtentions.Config.SearchAmenitiesListMaxCount).ToList <string>();
            communityBlockVm.Images    = communityBlockVm.Images.TakeExceptFirst <ImageVm>(SearchExtentions.Config.AdditionalImagesMaxCount).ToList <ImageVm>();
            return(communityBlockVm);
        }
コード例 #2
0
        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);
        }