/// <summary> /// Removes the phone. /// </summary> /// <param name="organizationPhone">The organization phone.</param> public virtual void RemovePhone(OrganizationPhone organizationPhone) { if (_organizationPhones.Contains(organizationPhone)) { _organizationPhones.Remove(organizationPhone); } }
/// <summary> /// Adds the phone. /// </summary> /// <param name="organizationPhone">The organization phone.</param> public virtual void AddPhone(OrganizationPhone organizationPhone) { _organizationPhones.Add(organizationPhone); if (organizationPhone.IsPrimary) { MakePrimary(organizationPhone); } }
public virtual void MakePrimary(OrganizationPhone organizationPhone) { Check.IsNotNull(organizationPhone, "organizationPhone is required."); var currentPrimary = OrganizationPhones.FirstOrDefault(oa => oa.IsPrimary); if (currentPrimary != organizationPhone) { currentPrimary.IsPrimary = false; organizationPhone.IsPrimary = true; } }