public static TraineeshipSummary GetTraineeshipSummary(VacancySummary vacancy, Employer employer, Provider provider, IList <Category> categories, ILogService logService) { try { //Manually mapping rather than using automapper as the two enties are significantly different var location = GetGeoPoint(vacancy); var category = vacancy.GetCategory(categories); var subcategory = vacancy.GetSubCategory(categories); LogCategory(vacancy, logService, category); var summary = new TraineeshipSummary { Id = vacancy.VacancyId, //Goes into elastic unformatted for searching VacancyReference = vacancy.VacancyReferenceNumber.ToString(), Title = vacancy.Title, // ReSharper disable PossibleInvalidOperationException PostedDate = vacancy.DateQAApproved.Value, StartDate = vacancy.PossibleStartDate.Value, ClosingDate = vacancy.ClosingDate.Value, // ReSharper restore PossibleInvalidOperationException Description = vacancy.ShortDescription, NumberOfPositions = vacancy.NumberOfPositions, EmployerName = string.IsNullOrWhiteSpace(vacancy.EmployerAnonymousName) ? employer.FullName : vacancy.EmployerAnonymousName, IsEmployerAnonymous = !string.IsNullOrEmpty(vacancy.EmployerAnonymousName), ProviderName = provider.TradingName, IsPositiveAboutDisability = employer.IsPositiveAboutDisability, Location = location, CategoryCode = category.CodeName, Category = category.FullName, SubCategoryCode = subcategory.CodeName, SubCategory = subcategory.FullName, AnonymousEmployerName = vacancy.EmployerAnonymousName }; return(summary); } catch (Exception ex) { logService.Error($"Failed to map traineeship with Id: {vacancy?.VacancyId ?? 0}", ex); return(null); } }
public TraineeshipApplicationDetail() { Vacancy = new TraineeshipSummary(); }