Exemplo n.º 1
0
        public SortBy CalculateSortBy(SearchApprenticeshipVacanciesRequest request)
        {
            if (!string.IsNullOrEmpty(request.SortBy))
            {
                return((SortBy)Enum.Parse(typeof(SortBy), request.SortBy, ignoreCase: true));
            }

            return(request.IsGeoSearch ? SortBy.Distance : SortBy.Age);
        }
Exemplo n.º 2
0
 public VacancySearchParameters Convert(SearchApprenticeshipVacanciesRequest request)
 {
     return(new VacancySearchParameters
     {
         PageNumber = request.PageNumber,
         PageSize = request.PageSize,
         SortBy = _sortByCalculator.CalculateSortBy(request),
         FromDate = request.PostedInLastNumberOfDays.HasValue
             ? DateTime.Today.AddDays(-request.PostedInLastNumberOfDays.Value)
             : (DateTime?)null,
         FrameworkLarsCodes = request.FrameworkLarsCodes.Select(x => x.Trim()).ToList(),
         StandardLarsCodes = request.StandardLarsCodes.Select(x => x.Trim()).ToList(),
         LocationType = request.NationwideOnly
             ? NationwideLocationType
             : NonNationwideLocationType,
         Longitude = request.NationwideOnly ? null : request.Longitude,
         Latitude = request.NationwideOnly ? null : request.Latitude,
         DistanceInMiles = request.NationwideOnly ? null : request.DistanceInMiles,
         Ukprn = request.Ukprn
     });
 }