From b581424a588f7782126ac6b6787ba81fade88bc9 Mon Sep 17 00:00:00 2001 From: Vincent ASTOLFI Date: Wed, 4 Jan 2023 17:12:35 +0100 Subject: [PATCH] =?UTF-8?q?ajout=20de=20toute=20les=20m=C3=A9thodes=20dans?= =?UTF-8?q?=20le=20stub?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/Data/Stub.cs | 42 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/Sources/Data/Stub.cs b/Sources/Data/Stub.cs index 0f4306b..9b01c66 100644 --- a/Sources/Data/Stub.cs +++ b/Sources/Data/Stub.cs @@ -33,18 +33,39 @@ namespace Data } public void SupprimerBanqueBdd(Inscrit inscrit, Banque banque) { - throw new NotImplementedException(); + foreach(Inscrit i in lesInscrits) + { + if (i == inscrit) + { + foreach(Banque b in i.LesBanques) + { + if(b == banque) + { + i.SupprimerBanque(b); + } + } + } + } } public void SupprimerToutesBanquesBdd(Inscrit inscrit) { - throw new NotImplementedException(); + foreach(Inscrit i in lesInscrits) + { + if(i == inscrit) + { + foreach(Banque b in i.LesBanques) + { + i.SupprimerBanque(b); + } + } + } } public void CreateInscrit(Inscrit inscrit){ lesInscrits.Add(inscrit); } public string LastInscrit() { - return "1"; + return lesInscrits[lesInscrits.Count - 1].Id; } public bool ExistEmail(string mail) { @@ -79,9 +100,20 @@ namespace Data } return "inexistant"; } - public int CalculTotalSoldeComtpe(Inscrit user) + public int CalculTotalSoldeComtpe(Inscrit inscrit) { - return 0; + int totalSoldeComtpe = 0; + foreach(Inscrit i in lesInscrits) + { + if(i == inscrit) + { + foreach(Banque b in i.LesBanques) + { + totalSoldeComtpe = b.ListeDesComptes.Sum(x => Convert.ToInt32(x)); + } + } + } + return totalSoldeComtpe; } public List LoadBanqueId(string id) {