From 7d90c569f07eaba66555a7867009f14737e54aa5 Mon Sep 17 00:00:00 2001 From: Augustin AFFOGNON Date: Sat, 22 Oct 2022 18:58:03 +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 | 258 ++++++++++++++--------------- 1 file changed, 129 insertions(+), 129 deletions(-) diff --git a/Sources/BowlingLib/Model/Equipe.cs b/Sources/BowlingLib/Model/Equipe.cs index 0723871..9c64cb1 100644 --- a/Sources/BowlingLib/Model/Equipe.cs +++ b/Sources/BowlingLib/Model/Equipe.cs @@ -1,129 +1,129 @@ - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace BowlingLib.Model -{ - /// - /// Classe Model Equipe - /// - public class Equipe - { - private string nom; - private readonly long id; - - - public List Joueurs = new List(); - - - public string Nom - { - get { return nom; } - set { nom = value; } - } - - - - - public Equipe(string nom, params Joueur[] joueurs) - { - this.nom = nom; - AjouterJoueurs(joueurs); - // foreach (Joueur nouv in joueurs) AjouterJoueur(nouv); - - } - public long Id - { - get { return id; } - } - - - public Equipe(string nom) - { - this.nom = nom; - } - - public Equipe(long id, string nom, List joueurs) - { - this.id = id; - Joueurs = joueurs; - Nom = nom; - } - - /// - /// Ajoute une liste de joueur à l'équipe - /// - /// - /// - public List AjouterJoueurs(params Joueur[] joueurs) - { - List result = new(); - foreach (var a in joueurs) - { - if (AjouterJoueur(a)) - { - result.Add(a); - } - } - return result; - - - } - - /// - /// Ajouter un joueur s'il n'exciste pas dans la bd - /// - /// - /// - - public bool AjouterJoueur(Joueur joueur) - { - if (!isExist(joueur)) - { - Joueurs.Add(joueur); - return true; - } - else - { - return false; - } - } - - /// - /// Supprimer un joueur - /// - /// - - public void SupprimerJoueur(Joueur joueur) - { - Joueurs.Remove(joueur); - } - - /// - /// retourner la liste non modifiable des joueurs de l'équipe - /// - /// - public List GetJoueurs() - { - return Joueurs; - } - - - /// - /// Fonction permettant de vérifier si un joueur existe déjà dans la liste (l'équipe) - /// - /// - /// - public bool isExist(Joueur nouvJoueur) - { - if (Joueurs.Contains(nouvJoueur)) - return true; - return false; - } - - } -} + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BowlingLib.Model +{ + /// + /// Classe Model Equipe + /// + public class Equipe + { + private string nom; + private readonly long id; + + + public List Joueurs = new List(); + + + public string Nom + { + get { return nom; } + set { nom = value; } + } + + + + + public Equipe(string nom, params Joueur[] joueurs) + { + this.nom = nom; + AjouterJoueurs(joueurs); + // foreach (Joueur nouv in joueurs) AjouterJoueur(nouv); + + } + public long Id + { + get { return id; } + } + + + public Equipe(string nom) + { + this.nom = nom; + } + + public Equipe(long id, string nom, List joueurs) + { + this.id = id; + Joueurs = joueurs; + Nom = nom; + } + + /// + /// Ajoute une liste de joueur à l'équipe + /// + /// + /// + public IEnumerable AjouterJoueurs(params Joueur[] joueurs) + { + List result = new(); + foreach (var a in joueurs) + { + if (AjouterJoueur(a)) + { + result.Add(a); + } + } + return result; + + + } + + /// + /// Ajouter un joueur s'il n'exciste pas dans la bd + /// + /// + /// + + public bool AjouterJoueur(Joueur joueur) + { + if (!isExist(joueur)) + { + Joueurs.Add(joueur); + return true; + } + else + { + return false; + } + } + + /// + /// Supprimer un joueur + /// + /// + + public void SupprimerJoueur(Joueur joueur) + { + Joueurs.Remove(joueur); + } + + /// + /// retourner la liste non modifiable des joueurs de l'équipe + /// + /// + public List GetJoueurs() + { + return Joueurs; + } + + + /// + /// Fonction permettant de vérifier si un joueur existe déjà dans la liste (l'équipe) + /// + /// + /// + public bool isExist(Joueur nouvJoueur) + { + if (Joueurs.Contains(nouvJoueur)) + return true; + return false; + } + + } +}