private static JobAd Copy(JobAd jobAd) { return(new JobAd { Title = jobAd.Title, Integration = { ExternalApplyUrl = jobAd.Integration.ExternalApplyUrl, ExternalReferenceId = jobAd.Integration.ExternalReferenceId, IntegratorReferenceId = jobAd.Integration.IntegratorReferenceId, JobBoardId = jobAd.Integration.JobBoardId }, Description = { CompanyName = jobAd.Description.CompanyName, BulletPoints = jobAd.Description.BulletPoints == null ? null : MiscUtils.Clone(jobAd.Description.BulletPoints.ToArray()), Content = jobAd.Description.Content, JobTypes = jobAd.Description.JobTypes, Package = jobAd.Description.Package, PositionTitle = jobAd.Description.PositionTitle, ResidencyRequired = jobAd.Description.ResidencyRequired, Salary = jobAd.Description.Salary == null ? null : jobAd.Description.Salary.Clone(), Summary = jobAd.Description.Summary, Location = jobAd.Description.Location == null ? null : jobAd.Description.Location.Clone(), Industries = jobAd.Description.Industries == null ? null : new List <Industry>(jobAd.Description.Industries) }, ContactDetails = jobAd.ContactDetails == null ? null : new ContactDetails { FirstName = jobAd.ContactDetails.FirstName, LastName = jobAd.ContactDetails.LastName, CompanyName = jobAd.ContactDetails.CompanyName, EmailAddress = jobAd.ContactDetails.EmailAddress, FaxNumber = jobAd.ContactDetails.FaxNumber, PhoneNumber = jobAd.ContactDetails.PhoneNumber } }); }
private static void CopyTo(JobAd jobAd, JobAd existingJobAd) { // Copy all the properties that are set by the caller when posting a job ad and leave the rest. existingJobAd.Title = jobAd.Title; existingJobAd.Integration.ExternalApplyUrl = jobAd.Integration.ExternalApplyUrl; existingJobAd.Integration.ExternalReferenceId = jobAd.Integration.ExternalReferenceId; existingJobAd.Integration.IntegratorReferenceId = jobAd.Integration.IntegratorReferenceId; existingJobAd.Integration.JobBoardId = jobAd.Integration.JobBoardId; existingJobAd.Integration.ApplicationRequirements = jobAd.Integration.ApplicationRequirements == null ? null : new ApplicationRequirements { IncludeResume = jobAd.Integration.ApplicationRequirements.IncludeResume, IncludeCoverLetter = jobAd.Integration.ApplicationRequirements.IncludeCoverLetter, Questions = Copy(jobAd.Integration.ApplicationRequirements.Questions), }; if (jobAd.ExpiryTime != null) { existingJobAd.ExpiryTime = jobAd.ExpiryTime; } existingJobAd.Description.CompanyName = jobAd.Description.CompanyName; existingJobAd.Description.BulletPoints = jobAd.Description.BulletPoints == null ? null : MiscUtils.Clone(jobAd.Description.BulletPoints.ToArray()); existingJobAd.Description.Content = jobAd.Description.Content; existingJobAd.Description.JobTypes = jobAd.Description.JobTypes; existingJobAd.Description.Package = jobAd.Description.Package; existingJobAd.Description.PositionTitle = jobAd.Description.PositionTitle; existingJobAd.Description.ResidencyRequired = jobAd.Description.ResidencyRequired; existingJobAd.Description.Salary = jobAd.Description.Salary == null ? null : jobAd.Description.Salary.Clone(); existingJobAd.Description.Summary = jobAd.Description.Summary; existingJobAd.Description.Location = jobAd.Description.Location == null ? null : jobAd.Description.Location.Clone(); existingJobAd.Description.Industries = jobAd.Description.Industries == null ? null : new List <Industry>(jobAd.Description.Industries); existingJobAd.ContactDetails = jobAd.ContactDetails == null ? null : new ContactDetails { FirstName = jobAd.ContactDetails.FirstName, LastName = jobAd.ContactDetails.LastName, CompanyName = jobAd.ContactDetails.CompanyName, EmailAddress = jobAd.ContactDetails.EmailAddress, FaxNumber = jobAd.ContactDetails.FaxNumber, PhoneNumber = jobAd.ContactDetails.PhoneNumber }; }