public void AggiungiMembro(Utente utente) { if (utente == null) { throw new ArgumentNullException("utente"); } if (MembriGruppo.Contains(utente)) { throw new ArgumentException("Utente " + utente.Mail + " già presente", "membro"); } _membriGruppo.Add(utente); utente.AggiungiGruppo(this); }
public void RimuoviMembro(string mail) { if (string.IsNullOrEmpty(mail)) { throw new ArgumentNullException("utente"); } Utente utente = MembriGruppo.First(u => u.Mail.Equals(mail)); if (utente == null) { throw new ArgumentException("Utente non presente"); } _membriGruppo.Remove(utente); utente.RimuoviGruppo(this); }