private void AddPatientAddress(PatientAddressDto patientAddressDto, Patient patient) { var addressType = _mappingHelper.MapLookupField <PatientAddressType> (patientAddressDto.PatientAddressType); var countyAreaLookup = _mappingHelper.MapLookupField <CountyArea> (patientAddressDto.CountyArea); var stateProvinceLookup = _mappingHelper.MapLookupField <StateProvince> (patientAddressDto.StateProvince); var countryLookup = _mappingHelper.MapLookupField <Country> (patientAddressDto.Country); var address = new AddressBuilder() .WithFirstStreetAddress(patientAddressDto.FirstStreetAddress) .WithSecondStreetAddress(patientAddressDto.SecondStreetAddress) .WithCityName(patientAddressDto.CityName) .WithCountyArea(countyAreaLookup) .WithStateProvince(stateProvinceLookup) .WithCountry(countryLookup) .WithPostalCode( string.IsNullOrWhiteSpace(patientAddressDto.PostalCode) ? null : new PostalCode(patientAddressDto.PostalCode)) .Build(); var patientAddress = new PatientAddressBuilder() .WithPatientAddressType(addressType) .WithAddress(address) .WithConfidentialIndicator(patientAddressDto.ConfidentialIndicator) .WithYearsOfStayNumber(patientAddressDto.YearsOfStayNumber) .Build(); patient.AddAddress(patientAddress); }
private static void RemovePatientAddress(PatientAddressDto patientAddressDto, Patient patient, PatientAddress patientAddress) { patient.RemoveAddress(patientAddress); }
private void ChangePatientAddress(PatientAddressDto patientAddressDto, Patient patient, PatientAddress patientAddress) { RemovePatientAddress(patientAddressDto, patient, patientAddress); AddPatientAddress(patientAddressDto, patient); }