public async Task MapFromVacancyAsync(DisplayVacancyViewModel vm, Vacancy vacancy) { var programme = await _vacancyClient.GetApprenticeshipProgrammeAsync(vacancy.ProgrammeId); var allQualifications = await _vacancyClient.GetCandidateQualificationsAsync(); vm.ApplicationMethod = vacancy.ApplicationMethod; vm.ApplicationInstructions = vacancy.ApplicationInstructions; vm.ApplicationUrl = vacancy.ApplicationUrl; vm.CanDelete = vacancy.CanDelete; vm.CanSubmit = vacancy.CanSubmit; vm.ClosingDate = (vacancy.ClosedDate ?? vacancy.ClosingDate)?.AsGdsDate(); vm.EducationLevelName = EducationLevelNumberHelper.GetEducationLevelNameOrDefault(programme.EducationLevelNumber, programme.ApprenticeshipLevel); vm.EmployerDescription = vacancy.EmployerDescription; vm.EmployerName = await _vacancyClient.GetEmployerNameAsync(vacancy); vm.EmployerWebsiteUrl = vacancy.EmployerWebsiteUrl; vm.EmployerAddressElements = Enumerable.Empty <string>(); vm.FindAnApprenticeshipUrl = _externalLinksConfiguration.FindAnApprenticeshipUrl; vm.IsAnonymous = vacancy.IsAnonymous; vm.NumberOfPositions = vacancy.NumberOfPositions?.ToString(); vm.NumberOfPositionsCaption = vacancy.NumberOfPositions.HasValue ? $"{"position".ToQuantity(vacancy.NumberOfPositions.Value)} available" : null; vm.OutcomeDescription = vacancy.OutcomeDescription; vm.PossibleStartDate = vacancy.StartDate?.AsGdsDate(); vm.ProviderContactName = vacancy.ProviderContact?.Name; vm.ProviderContactEmail = vacancy.ProviderContact?.Email; vm.ProviderContactTelephone = vacancy.ProviderContact?.Phone; vm.ProviderName = vacancy.TrainingProvider?.Name; vm.Qualifications = vacancy.Qualifications.SortQualifications(allQualifications).AsText(); vm.ShortDescription = vacancy.ShortDescription; vm.Skills = vacancy.Skills ?? Enumerable.Empty <string>(); vm.ThingsToConsider = vacancy.ThingsToConsider; vm.Title = vacancy.Title; vm.TrainingDescription = vacancy.TrainingDescription; vm.VacancyDescription = vacancy.Description; vm.VacancyReferenceNumber = vacancy.VacancyReference.HasValue ? $"VAC{vacancy.VacancyReference.ToString()}" : string.Empty; vm.IsDisabilityConfident = vacancy.IsDisabilityConfident; if (vacancy.EmployerLocation != null) { vm.MapUrl = MapImageHelper.GetEmployerLocationMapUrl(vacancy, _mapService, MapImageWidth, MapImageHeight); vm.EmployerAddressElements = vacancy.EmployerAddressForDisplay(); } if (vacancy.ProgrammeId != null) { vm.TrainingTitle = programme?.Title; vm.TrainingType = programme?.ApprenticeshipType.GetDisplayName(); vm.TrainingLevel = programme?.ApprenticeshipLevel.GetDisplayName(); } if (vacancy.Wage != null) { vm.ExpectedDuration = (vacancy.Wage.DurationUnit.HasValue && vacancy.Wage.Duration.HasValue) ? vacancy.Wage.DurationUnit.Value.GetDisplayName().ToQuantity(vacancy.Wage.Duration.Value) : null; vm.HoursPerWeek = $"{vacancy.Wage.WeeklyHours:0.##}"; vm.WageInfo = vacancy.Wage.WageAdditionalInformation; vm.WageText = vacancy.StartDate.HasValue ? vacancy.Wage.ToText(vacancy.StartDate) : null; vm.WorkingWeekDescription = vacancy.Wage.WorkingWeekDescription; } }