Update Manager.cs and Stub.cs

pull/23/head
Titouan LOUVET 2 years ago
parent 31275eb0d9
commit 02c9db5f6d

@ -6,11 +6,23 @@ namespace Banquale.Model
{ {
public List<Client> ListeClients { get; private set; } public List<Client> ListeClients { get; private set; }
public Manager() {
ListeClients = new List<Client>(); public List<Transactions> ListeTransactions { get; private set; }
public IPersistanceManager Persistance { get; set; }
public Manager(IPersistanceManager persistance) {
ListeTransactions = new List<Transactions>();
ListeClients = new List<Client>();
Persistance = persistance;
} }
public bool AjouterClient(Client MonClient) public Manager()
{
ListeClients = new List<Client>();
ListeTransactions = new List<Transactions>();
}
public bool AjouterClient(Client MonClient)
{ {
ListeClients.Add(MonClient); ListeClients.Add(MonClient);
return true; return true;
@ -20,15 +32,18 @@ namespace Banquale.Model
return ListeClients[place]; return ListeClients[place];
} }
public void Donnee()
public void ChargeDonnee()
{ {
Client Client1= new Client("Jacques", "Morice", "J'aimeLesFrites"); var donnees = Persistance.ChargeDonnee();
Client Client2 = new Client("Francis", "Begore", "J'aimeLes"); foreach (var j in donnees.Item1)
Client Client3 = new Client("Michel", "Boudout", "MonMdP"); {
Console.WriteLine(Client1); ListeClients.Add(j);
AjouterClient(Client1); }
AjouterClient(Client2); foreach (var i in donnees.Item2)
AjouterClient(Client3); {
ListeTransactions.Add(i);
}
} }
} }
} }

@ -13,10 +13,11 @@ namespace Banquale.Stub
Client Client3 = new Client("Michel", "Boudout", "MonMdP"); Client Client3 = new Client("Michel", "Boudout", "MonMdP");
Console.WriteLine(Client1); Console.WriteLine(Client1);
List<Client> ListeClients = new List<Client>(); List<Client> ListeClients = new List<Client>();
List<Transactions> ListeTransactions = new List<Transactions>();
ListeClients.Add(Client1); ListeClients.Add(Client1);
ListeClients.Add(Client2); ListeClients.Add(Client2);
ListeClients.Add(Client3); ListeClients.Add(Client3);
return ListeClients; return (ListeClients, ListeTransactions);
} }
void IPersistanceManager.SauvegardeDonnee(List<Client> c, List<Transactions> t) void IPersistanceManager.SauvegardeDonnee(List<Client> c, List<Transactions> t)

Loading…
Cancel
Save