Exemple #1
0
        public ActionResult Resources()
        {
            // Gather all the pieces.

            var poll = _pollsQuery.GetActivePoll();

            var featuredArticles = _resourcesQuery.GetFeaturedArticles();
            var articles         = _resourcesQuery.GetArticles(from a in featuredArticles select a.ResourceId);

            var featuredVideo = _resourcesQuery.GetFeaturedVideos().Single();
            var video         = _resourcesQuery.GetVideo(featuredVideo.ResourceId);

            var featuredQnA = _resourcesQuery.GetFeaturedQnAs().Single();
            var qna         = _resourcesQuery.GetQnA(featuredQnA.ResourceId);

            return(View(new ResourcesModel
            {
                Categories = _resourcesQuery.GetCategories(),
                FeaturedArticles = featuredArticles.Select(r => new FeaturedArticleModel {
                    FeaturedResource = r, Article = articles.Single(a => a.Id == r.ResourceId)
                }).ToList(),
                FeaturedVideo = video,
                FeaturedQnA = qna,
                FeaturedQnAViews = qna != null ? _resourcesQuery.GetViewingCount(qna.Id) : 0,
                FeaturedQnAComments = qna != null ? _disqusQuery.GetCommentCount(qna.Id) ?? 0 : 0,
                ActivePoll = GetPollModel(poll),
            }));
        }
Exemple #2
0
        private HomeModel CreateHomeModel(UserType preferredUserType, Login login, MemberJoin join, bool acceptTerms)
        {
            var country = ActivityContext.Location.Country;

            var qna = _resourcesQuery.GetQnA(_resourcesQuery.GetFeaturedQnAs().Single().ResourceId);

            return(new HomeModel
            {
                PreferredUserType = preferredUserType,
                Login = login,
                Join = join,
                AcceptTerms = acceptTerms,
                Reference = new ReferenceModel
                {
                    MinSalary = JobAdSearchCriteria.MinSalary,
                    MaxSalary = JobAdSearchCriteria.MaxSalary,
                    StepSalary = JobAdSearchCriteria.StepSalary,
                    MinHourlySalary = JobAdSearchCriteria.MinHourlySalary,
                    MaxHourlySalary = JobAdSearchCriteria.MaxHourlySalary,
                    StepHourlySalary = JobAdSearchCriteria.StepHourlySalary,
                    Industries = GetIndustries(),
                    FeaturedStatistics = GetFeaturedStatistics(),
                    FeaturedEmployers = GetFeaturedEmployers(),
                    FeaturedJobAds = GetFeaturedJobAds(),
                    FeaturedCandidateSearches = GetFeaturedCandidateSearches(),
                    Countries = _locationQuery.GetCountries(),
                    CountrySubdivisions = (from s in _locationQuery.GetCountrySubdivisions(country) where !s.IsCountry select s).ToList(),
                    Regions = _locationQuery.GetRegions(country),
                    DefaultCountry = country,
                    FeaturedAnsweredQuestion = qna,
                    Categories = _resourcesQuery.GetCategories(),
                }
            });
        }
Exemple #3
0
        internal SubcategoryContentHandler(IBooster booster, IResourcesQuery resourcesQuery, IFaqsQuery faqsQuery)
        {
            _booster = booster;
            var resourceCategories = resourcesQuery.GetCategories();
            var faqCategories      = faqsQuery.GetCategories();

            _categories = resourceCategories.Concat(faqCategories).ToList();
        }
Exemple #4
0
        public void TestOldArticleUrls()
        {
            var url = new ReadOnlyApplicationUrl("~/members/resources/articles");

            AssertRedirect(new ReadOnlyApplicationUrl("~/members/resources/articles/all"), url, url);

            url = new ReadOnlyApplicationUrl("~/members/resources/articles/recent");
            AssertRedirect(new ReadOnlyApplicationUrl("~/members/resources/recentlyviewed/article"), url, url);

            var          categories         = _resourcesQuery.GetCategories();
            const string categorySegment    = "job-search";
            var          subcategory        = categories.SelectMany(c => c.Subcategories).Single(s => s.Name == "Job seeking tips");
            const string subcategorySegment = "job-seeking-tips";

            var article = _resourcesQuery.GetArticles().First(a => a.SubcategoryId == subcategory.Id);

            url = new ReadOnlyApplicationUrl("~/members/resources/articles/" + categorySegment + "-" + subcategorySegment + "-" + GetUrlSegmentTitle(article.Title) + "/" + article.Id);
            AssertRedirect(new ReadOnlyApplicationUrl("~/members/resources/article/" + categorySegment + "-" + subcategorySegment + "-" + GetUrlSegmentTitle(article.Title) + "/" + article.Id), url, url);
        }
Exemple #5
0
 protected Category GetCategory(Guid subcategoryId)
 {
     return((from c in _resourcesQuery.GetCategories()
             where c.Subcategories.Any(s => s.Id.Equals(subcategoryId))
             select c).SingleOrDefault());
 }