private void AddBillingOfficeAddress(BillingOfficeAddressDto billingOfficeAddressDto, BillingOffice billingOffice) { var addressType = _mappingHelper.MapLookupField <BillingOfficeAddressType> (billingOfficeAddressDto.BillingOfficeAddressType); var countyAreaLookup = _mappingHelper.MapLookupField <CountyArea> (billingOfficeAddressDto.CountyArea); var stateProvinceLookup = _mappingHelper.MapLookupField <StateProvince> (billingOfficeAddressDto.StateProvince); var countryLookup = _mappingHelper.MapLookupField <Country> (billingOfficeAddressDto.Country); var address = new AddressBuilder() .WithFirstStreetAddress(billingOfficeAddressDto.FirstStreetAddress) .WithSecondStreetAddress(billingOfficeAddressDto.SecondStreetAddress) .WithCityName(billingOfficeAddressDto.CityName) .WithCountyArea(countyAreaLookup) .WithStateProvince(stateProvinceLookup) .WithCountry(countryLookup) .WithPostalCode( string.IsNullOrWhiteSpace(billingOfficeAddressDto.PostalCode) ? null : new PostalCode(billingOfficeAddressDto.PostalCode)) .Build(); var billingOfficeAddress = new BillingOfficeAddress(addressType, address); billingOffice.AddAddress(billingOfficeAddress); }
private static void RemoveBillingOfficeAddress( BillingOfficeAddressDto billingOfficeAddressDto, BillingOffice billingOffice, BillingOfficeAddress billingOfficeAddress) { billingOffice.RemoveAddress(billingOfficeAddress); }
private void ChangeBillingOfficeAddress( BillingOfficeAddressDto billingOfficeAddressDto, BillingOffice billingOffice, BillingOfficeAddress billingOfficeAddress) { RemoveBillingOfficeAddress(billingOfficeAddressDto, billingOffice, billingOfficeAddress); AddBillingOfficeAddress(billingOfficeAddressDto, billingOffice); }