public AccessRequestViewModel ConvertToViewModel(AccessRequest domain) { return(new AccessRequestViewModel() { Address = _addressDomainToViewModelMapper.ConvertToViewModel(domain.Address), Email = domain.Email, Firstname = domain.Firstname, Lastname = domain.Lastname, Companyname = domain.Companyname, WorkPhoneNumber = domain.WorkPhoneNumber, MobileNumber = domain.MobileNumber, Title = domain.Title, Position = domain.Position, HasApprenticeshipVacancies = domain.HasApprenticeshipVacancies, UserType = domain.UserType, Systemname = domain.Systemname, Contactname = domain.Contactname, AdditionalEmail = domain.AdditionalEmail, AdditionalPhoneNumber = domain.AdditionalPhoneNumber, ServiceTypes = new AccessRequestServicesViewModel() { PostedServiceIds = domain.SelectedServiceTypeIds.Split(',') } }); }
public LocationViewModel ConvertToViewModel(Location domain) { domain.ThrowIfNull("Location", "domain object of type Location can't be null"); return(new LocationViewModel() { Address = _addressDomainToViewModelMapper.ConvertToViewModel(domain.Address), Latitude = domain.Latitude, Longitude = domain.Longitude }); }
public ReferenceDataListViewModel GetReferenceData(ReferenceDataTypes type) { try { var referenceData = _referenceDataService.Get(type); var referenceDataViewModel = referenceData.Select(m => _referenceDataDomainToViewModelMapper.ConvertToViewModel(m)); IEnumerable <ReferenceDataViewModel> referenceDataViewModels = referenceDataViewModel as IList <ReferenceDataViewModel> ?? referenceDataViewModel.ToList(); if (!referenceDataViewModels.IsNullOrEmpty()) { return(new ReferenceDataListViewModel(referenceDataViewModels)); } return(new ReferenceDataListViewModel()); } catch (System.Exception) { //todo: log error using preferred logging mechanism return(new ReferenceDataListViewModel()); } }
public LocationsViewModel FindAddress(string postcode) { try { var addressData = _locationSearchService.FindAddress(postcode); var addressDataViewModel = addressData.Select(m => _locationDomainToViewModelMapper.ConvertToViewModel(m)); IEnumerable <LocationViewModel> locationViewModels = addressDataViewModel as IList <LocationViewModel> ?? addressDataViewModel.ToList(); if (!locationViewModels.IsNullOrEmpty()) { return(new LocationsViewModel(locationViewModels)); } return(new LocationsViewModel()); } catch (System.Exception exception) { //todo: log error using preferred logging mechanism return(new LocationsViewModel()); } }
public EmployerEnquiryViewModel ConvertToViewModel(EmployerEnquiry domain) { domain.ThrowIfNull("EmployerEnquiry", "domain object of type EmployerEnquiry can't be null"); return(new EmployerEnquiryViewModel() { Address = _addressDomainToViewModelMapper.ConvertToViewModel(domain.ApplicantAddress), Email = domain.Email, EmployeesCount = domain.EmployeesCount, EnquiryDescription = domain.EnquiryDescription, EnquirySource = domain.EnquirySource, Firstname = domain.Firstname, Lastname = domain.Lastname, WorkPhoneNumber = domain.WorkPhoneNumber, MobileNumber = domain.MobileNumber, Title = domain.Title, Companyname = domain.Companyname, Position = domain.Position, PreviousExperienceType = domain.PreviousExperienceType, WorkSector = domain.WorkSector }); }