/// <summary> /// Removes the address. /// </summary> /// <param name="organizationAddress">The organization address.</param> public virtual void RemoveAddress(OrganizationAddress organizationAddress) { if (_organizationAddresses.Contains(organizationAddress)) { _organizationAddresses.Remove(organizationAddress); } }
/// <summary> /// Adds the address. /// </summary> /// <param name="organizationAddress">The organization address.</param> public virtual void AddAddress(OrganizationAddress organizationAddress) { _organizationAddresses.Add(organizationAddress); if (organizationAddress.IsPrimary) { MakePrimary(organizationAddress); } }
public virtual void MakePrimary(OrganizationAddress organizationAddress) { Check.IsNotNull(organizationAddress, "organizationAddress is required."); var currentPrimary = OrganizationAddresses.FirstOrDefault(oa => oa.IsPrimary); if (currentPrimary != organizationAddress) { currentPrimary.IsPrimary = false; organizationAddress.IsPrimary = true; } }