You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
BowlingScoreApp/Sources/BowlingStub/StubJoueur.cs

71 lines
1.6 KiB

using BowlingLib.Model;
using Business;
using System;
namespace BowlingStub
{
public class StubJoueur : IDataManager<Joueur>
{
private List<Joueur> listJoueurs = new List<Joueur>();
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<Joueur> GetAll()
{
return listJoueurs;
}
//n represente le nbr de joueurs a creer dans la liste
public IEnumerable<Joueur> 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;
}
}
}