From 2902aa262d0859c7b871c04a3010262c6fa55cef Mon Sep 17 00:00:00 2001 From: Augustin AFFOGNON Date: Sat, 22 Oct 2022 20:14:55 +0200 Subject: [PATCH] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'Sources/BowlingLib?= =?UTF-8?q?/Model/Equipe.cs'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/BowlingLib/Model/Equipe.cs | 34 ++++++++++++++++++------------ 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/Sources/BowlingLib/Model/Equipe.cs b/Sources/BowlingLib/Model/Equipe.cs index 9c64cb1..e8df91b 100644 --- a/Sources/BowlingLib/Model/Equipe.cs +++ b/Sources/BowlingLib/Model/Equipe.cs @@ -13,19 +13,20 @@ namespace BowlingLib.Model /// public class Equipe { - private string nom; - private readonly long id; + public string Nom { get; private set; }; + public long Id { get; private set; }; + public ReadOnlyCollection Joueurs { get; private set; } - public List Joueurs = new List(); + private List joueurs = new List(); - public string Nom + /* public string Nom { get { return nom; } set { nom = value; } } - +*/ @@ -44,16 +45,21 @@ namespace BowlingLib.Model public Equipe(string nom) { - this.nom = nom; + Nom = nom; } - public Equipe(long id, string nom, List joueurs) + public Equipe(long id, string nom, params Joueur[] joueurs) { - this.id = id; - Joueurs = joueurs; + Id = id; + // Joueurs = joueurs; Nom = nom; + Joueurs = new ReadOnlyCollection(this.joueurs); + AjouterJoueurs(artists); } + public Equipe(long id, string nom, params Joueur[] joueurs) + : this(0, nom, joueurs) {} + /// /// Ajoute une liste de joueur à l'équipe /// @@ -84,7 +90,7 @@ namespace BowlingLib.Model { if (!isExist(joueur)) { - Joueurs.Add(joueur); + joueurs.Add(joueur); return true; } else @@ -100,17 +106,17 @@ namespace BowlingLib.Model public void SupprimerJoueur(Joueur joueur) { - Joueurs.Remove(joueur); + joueurs.Remove(joueur); } /// /// retourner la liste non modifiable des joueurs de l'équipe /// /// - public List GetJoueurs() + /* public List GetJoueurs() { return Joueurs; - } + }*/ /// @@ -120,7 +126,7 @@ namespace BowlingLib.Model /// public bool isExist(Joueur nouvJoueur) { - if (Joueurs.Contains(nouvJoueur)) + if (joueurs.Contains(nouvJoueur)) return true; return false; }