using BowlingLib.Model; using Business; using System; namespace BowlingStub { public class StubJoueur : IDataManager { private List listJoueurs = new List(); public bool Add(Joueur data) { if (data != null) { listJoueurs.Add(data); return true; } return false; } public bool Delete(Joueur data) { if (data != null) { listJoueurs.Remove(data); return true; } return false; } public IEnumerable GetAll() { return listJoueurs; } //n represente le nbr de joueurs a creer dans la liste public IEnumerable GetAll(int n = 10) { for (int i = 0; i < n; i++) { Add(new Joueur("Joueur " + i + 1)); } return listJoueurs; } ///ged public Joueur GetDataWithId(int id) { throw new NotImplementedException(); } public Joueur GetDataWithName(string name) { throw new NotImplementedException(); }// public bool Update(Joueur data) { if (data != null) { int index = listJoueurs.FindIndex(x => x.Id == data.Id); listJoueurs[index] = data; return true; } return false; } } }