public ActionResult LocationJobAds(string locationSegment) { var location = _locationQuery.GetLocationByUrlSegment(ActivityContext.Location.Country, locationSegment, JobAdsRoutes.SegmentSuffix); if (location == null) { return(RedirectToUrl(JobAdsRoutes.BrowseJobAds.GenerateUrl(), true)); } // Check the url. var result = EnsureUrl(location.GenerateJobAdsUrl()); if (result != null) { return(result); } // Return the view for this location. return(View(new IndustriesJobAdsModel { Location = location, Industries = _industriesQuery.GetIndustries(), })); }
public ActionResult LocationCandidates(string locationSegment) { var location = _locationQuery.GetLocationByUrlSegment(ActivityContext.Location.Country, locationSegment, CandidatesRoutes.SegmentSuffix); if (location == null) { return(RedirectToUrl(CandidatesRoutes.BrowseCandidates.GenerateUrl(), true)); } // Check the url. var result = EnsureUrl(location.GenerateCandidatesUrl()); if (result != null) { return(result); } // Return the view for this location. return(View(new SalaryBandsCandidatesModel { Location = location, SalaryBands = GetSalaryBands(), })); }
private ActionResult LocationIndustryJobAds(string locationSegment, string industrySegment, int?page) { var industry = _industriesQuery.GetIndustryByUrlSegment(industrySegment, JobAdsRoutes.SegmentSuffix); var location = _locationQuery.GetLocationByUrlSegment(ActivityContext.Location.Country, locationSegment, JobAdsRoutes.SegmentSuffix); if (industry == null && location == null) { return(RedirectToUrl(JobAdsRoutes.BrowseJobAds.GenerateUrl(), true)); } if (location == null) { return(RedirectToUrl(industry.GenerateJobAdsUrl(), true)); } if (industry == null) { return(RedirectToUrl(location.GenerateJobAdsUrl(), true)); } // Check url. var result = EnsureUrl(location.GenerateJobAdsUrl(industry, page)); if (result != null) { return(result); } if (page.HasValue && page.Value < 2) { //on page 0 or 1; should be page <blank> return(RedirectToUrl(location.GenerateJobAdsUrl(industry, null), true)); } //construct a criteria and presentation and return results var criteria = new JobAdSearchCriteria { Location = _locationQuery.ResolveLocation(ActivityContext.Location.Country, location.Name), IndustryIds = new List <Guid> { industry.Id }, SortCriteria = new JobAdSearchSortCriteria { ReverseSortOrder = false, SortOrder = JobAdSortOrder.CreatedTime }, }; var presentation = new JobAdsPresentationModel { Pagination = new Pagination { Page = page.HasValue ? page : 1 }, }; criteria.PrepareCriteria(); PreparePresentationModel(presentation); var browseList = Browse(CurrentMember, criteria, presentation, JobAdListType.BrowseResult); if ((browseList.Results.TotalJobAds <= (presentation.Pagination.Page - 1) * Reference.DefaultItemsPerPage) && presentation.Pagination.Page > 1) { //on some page that doesn't exist (anymore) - redirect to page one return(RedirectToUrl(location.GenerateJobAdsUrl(industry, null))); } browseList.Industry = industry; browseList.Location = location; return(View("Results", browseList)); }
private ActionResult LocationSalaryBandCandidates(string locationSegment, string salarySegment, int?page) { var salary = salarySegment.GetSalaryByUrlSegment(CandidatesRoutes.SegmentSuffix); var location = _locationQuery.GetLocationByUrlSegment(ActivityContext.Location.Country, locationSegment, CandidatesRoutes.SegmentSuffix); if (location == null && salary == null) { return(RedirectToUrl(CandidatesRoutes.BrowseCandidates.GenerateUrl(), true)); } if (location == null) { return(RedirectToUrl(salary.GenerateCandidatesUrl(), true)); } if (salary == null) { return(RedirectToUrl(location.GenerateCandidatesUrl(), true)); } // Check url. var result = EnsureUrl(location.GenerateCandidatesUrl(salary, page)); if (result != null) { return(result); } if (page.HasValue && page.Value < 2) { //on index 0 or 1; should be index <blank> return(RedirectToUrl(location.GenerateCandidatesUrl(salary, null), true)); } //construct a criteria and presentation and return results var criteria = new MemberSearchCriteria { Location = _locationQuery.ResolveLocation(_locationQuery.GetCountry("Australia"), location.Name), Salary = new Salary { LowerBound = salary.LowerBound, UpperBound = salary.UpperBound, Currency = Currency.AUD, Rate = SalaryRate.Year }, ExcludeNoSalary = true, SortCriteria = new MemberSearchSortCriteria { ReverseSortOrder = false, SortOrder = MemberSortOrder.DateUpdated }, }; var presentation = new CandidatesPresentationModel { Pagination = new Pagination { Page = page.HasValue ? page : 1, }, }; var employer = CurrentEmployer; PrepareCriteria(employer, criteria); PreparePresentationModel(presentation); var browseList = Browse(employer, criteria, presentation); if ((browseList.Results.TotalCandidates <= (presentation.Pagination.Page - 1) * Reference.DefaultItemsPerPage) && presentation.Pagination.Page > 1) { //on some page that doesn't exist (anymore) - redirect to page one return(RedirectToUrl(location.GenerateCandidatesUrl(salary, null))); } browseList.SalaryBand = criteria.Salary; browseList.Location = location; return(View("Results", browseList)); }