Example #1
0
        public void SetAddress(Address address)
        {
            if (address == null)
            {
                throw new ArgumentNullException(nameof(address));
            }
            var existingAddress = CompanyAddresses.FirstOrDefault(a => a.AddressType.AddressTypeCode == address.AddressType.AddressTypeCode);

            if (existingAddress != null)
            {
                CompanyAddresses.Remove(existingAddress);
            }
            CompanyAddresses.Add(address);
        }
Example #2
0
        private void SetAddress(AddressViewModel addressData)
        {
            if (addressData == null)
            {
                throw new ArgumentNullException(nameof(addressData));
            }
            var existingAddress = CompanyAddresses.FirstOrDefault(a => a.AddressType.AddressTypeCode == addressData.AddressType.AddressTypeCode);

            if (existingAddress != null)
            {
                CompanyAddresses.Remove(existingAddress);
            }
            CompanyAddresses.Add(addressData);
        }