/// <summary> /// Removes the address. /// </summary> /// <param name="organizationAddress">The organization address.</param> public void RemoveAddress(OrganizationAddress organizationAddress) { if (_organizationAddresses.Contains(organizationAddress)) { RaiseEvent(new OrganizationAddressRemovedEvent(Key, Version, organizationAddress)); } }
/// <summary> /// Adds the address. /// </summary> /// <param name="organizationAddress">The organization address.</param> public void AddAddress(OrganizationAddress organizationAddress) { RaiseEvent(new OrganizationAddressAddedEvent(Key, Version, organizationAddress)); if (organizationAddress.IsPrimary) { MakePrimary(organizationAddress); } }
/// <summary>Makes the address primary.</summary> /// <param name="organizationAddress">The organization address.</param> public void MakePrimary(OrganizationAddress organizationAddress) { Check.IsNotNull(organizationAddress, "organizationAddress is required."); var currentPrimary = OrganizationAddresses.FirstOrDefault(oa => oa.IsPrimary); if (currentPrimary != organizationAddress) { RaiseEvent(new OrganizaionPrimaryAddressChangedEvent(Key, Version, organizationAddress.GetHashCode())); } }