protected PolicyContact CreateContactFromDto(PolicyContact contact, PolicyContactDTO contactDto) { if (contact == null) { contact = new PolicyContact { CreatedAt = DateTime.UtcNow }; } contact.DateOfBirth = contactDto.DateOfBirth; contact.EmailAddress = contactDto.EmailAddress; contact.FirstName = contactDto.FirstName; contact.LastName = contactDto.LastName; contact.PhoneNumber = contactDto.PhoneNumber; if (contactDto.Address != null) { if (contact.Address == null) { contact.Address = new Address { CreatedAt = DateTime.UtcNow }; } contact.Address.AddressLine1 = contactDto.Address.AddressLine1; contact.Address.PostCode = contactDto.Address.PostCode; contact.Address.Suburb = contactDto.Address.Suburb; } return(contact); }
protected static void CreateContactDto(Policy pol, PolicyDTO dto) { PolicyContact contact = pol.Contact; dto.Contact = new PolicyContactDTO() { DateOfBirth = contact.DateOfBirth, EmailAddress = contact.EmailAddress, FirstName = contact.FirstName, LastName = contact.LastName, PhoneNumber = contact.PhoneNumber }; if (contact.Address != null) { dto.Contact.Address = new AddressDTO() { AddressLine1 = contact.Address.AddressLine1, PostCode = contact.Address.PostCode, Suburb = contact.Address.Suburb }; } }