Ejemplo n.º 1
0
        public static SeoVm GetSeo(ServiceProvidersSearchVm result)
        {
            SeoVm seoVm = new SeoVm()
            {
                PageType     = result.PageType,
                CanonicalUrl = MslcUrlBuilder.PagingUrl(result, result.PageNumber),
                LinkPrev     = SeoHelper.FormPageLink <ServiceProviderBlockVm, ServiceProviderSortType>(result, PageDirection.Previous),
                LinkNext     = SeoHelper.FormPageLink <ServiceProviderBlockVm, ServiceProviderSortType>(result, PageDirection.Next),
                MarketCopy   = SeoBc.Instance.GetServiceProvidersMarketCopy(result.Criteria.ToSearchCriteria())
            };
            PageType pageType = seoVm.PageType;

            if (pageType == PageType.ServiceProvidersByState)
            {
                seoVm.Title       = Title.SearchServicesByState;
                seoVm.Description = Description.SearchServicesByState;
                seoVm.Header      = Header.SearchServicesByState;
            }
            else if (pageType == PageType.ServiceProvidersByCity)
            {
                seoVm.Title       = Title.SearchServicesByCity;
                seoVm.Description = Description.SearchServicesByCity;
                seoVm.Header      = Header.SearchServicesByCity;
            }
            seoVm.Title       = seoVm.Title.Replace <ServiceProviderBlockVm, ServiceProviderSortType>(result);
            seoVm.Description = seoVm.Description.Replace <ServiceProviderBlockVm, ServiceProviderSortType>(result);
            seoVm.Header      = seoVm.Header.Replace <ServiceProviderBlockVm, ServiceProviderSortType>(result);
            seoVm.MarketCopy  = seoVm.MarketCopy.Replace <ServiceProviderBlockVm, ServiceProviderSortType>(result);
            return(seoVm);
        }
Ejemplo n.º 2
0
        private static string FormPageLink <TResult, TSort>(ResultSetSearchVm <TResult, TSort> searchResultVm, PageDirection direction)
        {
            string empty = string.Empty;

            if (searchResultVm.PageSize == 0 || searchResultVm.PageNumber == 0)
            {
                return(empty);
            }
            if (direction == PageDirection.Next)
            {
                if ((float)searchResultVm.PageNumber < (float)searchResultVm.TotalCount / (float)searchResultVm.PageSize)
                {
                    empty = MslcUrlBuilder.PagingUrl(searchResultVm, searchResultVm.PageNumber + 1);
                }
            }
            else if (searchResultVm.PageNumber > 1)
            {
                empty = MslcUrlBuilder.PagingUrl(searchResultVm, searchResultVm.PageNumber - 1);
            }
            return(empty);
        }
Ejemplo n.º 3
0
        public static SeoVm GetSeo(CommunitiesSearchVm result)
        {
            SeoVm seoVm = new SeoVm()
            {
                PageType     = result.PageType,
                CanonicalUrl = MslcUrlBuilder.PagingUrl((SearchVm)result, result.PageNumber),
                LinkPrev     = SeoHelper.FormPageLink <CommunityBlockVm, CommunitySortType>(result, PageDirection.Previous),
                LinkNext     = SeoHelper.FormPageLink <CommunityBlockVm, CommunitySortType>(result, PageDirection.Next),
                MarketCopy   = SeoBc.Instance.GetCommunityMarketCopy(result.Criteria.ToSearchCriteria(), result.Criteria.SearchType().ToListingType())
            };

            switch (seoVm.PageType)
            {
            case PageType.ShcByState:
            {
                seoVm.Title       = Title.SearchSHCByState;
                seoVm.Description = Description.SearchSHCByState;
                seoVm.Header      = Header.SearchSHCByState;
                seoVm.Title       = seoVm.Title.Replace <CommunityBlockVm, CommunitySortType>(result);
                seoVm.Description = seoVm.Description.Replace <CommunityBlockVm, CommunitySortType>(result);
                seoVm.Header      = seoVm.Header.Replace <CommunityBlockVm, CommunitySortType>(result);
                seoVm.MarketCopy  = seoVm.MarketCopy.Replace <CommunityBlockVm, CommunitySortType>(result);
                return(seoVm);
            }

            case PageType.ShcByCity:
            {
                seoVm.Title       = Title.SearchSHCByCity;
                seoVm.Description = Description.SearchSHCByCity;
                seoVm.Header      = Header.SearchSHCByCity;
                seoVm.Title       = seoVm.Title.Replace <CommunityBlockVm, CommunitySortType>(result);
                seoVm.Description = seoVm.Description.Replace <CommunityBlockVm, CommunitySortType>(result);
                seoVm.Header      = seoVm.Header.Replace <CommunityBlockVm, CommunitySortType>(result);
                seoVm.MarketCopy  = seoVm.MarketCopy.Replace <CommunityBlockVm, CommunitySortType>(result);
                return(seoVm);
            }

            case PageType.ShcByZip:
            case PageType.AacByType:
            case PageType.AacByZip:
            case PageType.AahByType:
            {
                seoVm.Title       = seoVm.Title.Replace <CommunityBlockVm, CommunitySortType>(result);
                seoVm.Description = seoVm.Description.Replace <CommunityBlockVm, CommunitySortType>(result);
                seoVm.Header      = seoVm.Header.Replace <CommunityBlockVm, CommunitySortType>(result);
                seoVm.MarketCopy  = seoVm.MarketCopy.Replace <CommunityBlockVm, CommunitySortType>(result);
                return(seoVm);
            }

            case PageType.AacByState:
            {
                seoVm.Title       = Title.SearchAACByState;
                seoVm.Description = Description.SearchAACByState;
                seoVm.Header      = Header.SearchAACByState;
                seoVm.Title       = seoVm.Title.Replace <CommunityBlockVm, CommunitySortType>(result);
                seoVm.Description = seoVm.Description.Replace <CommunityBlockVm, CommunitySortType>(result);
                seoVm.Header      = seoVm.Header.Replace <CommunityBlockVm, CommunitySortType>(result);
                seoVm.MarketCopy  = seoVm.MarketCopy.Replace <CommunityBlockVm, CommunitySortType>(result);
                return(seoVm);
            }

            case PageType.AacByCity:
            {
                seoVm.Title       = Title.SearchAACByCity;
                seoVm.Description = Description.SearchAACByCity;
                seoVm.Header      = Header.SearchAACByCity;
                seoVm.Title       = seoVm.Title.Replace <CommunityBlockVm, CommunitySortType>(result);
                seoVm.Description = seoVm.Description.Replace <CommunityBlockVm, CommunitySortType>(result);
                seoVm.Header      = seoVm.Header.Replace <CommunityBlockVm, CommunitySortType>(result);
                seoVm.MarketCopy  = seoVm.MarketCopy.Replace <CommunityBlockVm, CommunitySortType>(result);
                return(seoVm);
            }

            case PageType.AahByState:
            {
                seoVm.Title       = Title.SearchAAHByState;
                seoVm.Description = Description.SearchAAHByState;
                seoVm.Header      = Header.SearchAAHByState;
                seoVm.Title       = seoVm.Title.Replace <CommunityBlockVm, CommunitySortType>(result);
                seoVm.Description = seoVm.Description.Replace <CommunityBlockVm, CommunitySortType>(result);
                seoVm.Header      = seoVm.Header.Replace <CommunityBlockVm, CommunitySortType>(result);
                seoVm.MarketCopy  = seoVm.MarketCopy.Replace <CommunityBlockVm, CommunitySortType>(result);
                return(seoVm);
            }

            case PageType.AahByCity:
            {
                seoVm.Title       = Title.SearchAAHByCity;
                seoVm.Description = Description.SearchAAHByCity;
                seoVm.Header      = Header.SearchAAHByCity;
                seoVm.Title       = seoVm.Title.Replace <CommunityBlockVm, CommunitySortType>(result);
                seoVm.Description = seoVm.Description.Replace <CommunityBlockVm, CommunitySortType>(result);
                seoVm.Header      = seoVm.Header.Replace <CommunityBlockVm, CommunitySortType>(result);
                seoVm.MarketCopy  = seoVm.MarketCopy.Replace <CommunityBlockVm, CommunitySortType>(result);
                return(seoVm);
            }

            default:
            {
                seoVm.Title       = seoVm.Title.Replace <CommunityBlockVm, CommunitySortType>(result);
                seoVm.Description = seoVm.Description.Replace <CommunityBlockVm, CommunitySortType>(result);
                seoVm.Header      = seoVm.Header.Replace <CommunityBlockVm, CommunitySortType>(result);
                seoVm.MarketCopy  = seoVm.MarketCopy.Replace <CommunityBlockVm, CommunitySortType>(result);
                return(seoVm);
            }
            }
        }