From 8ff6eb669e7291787598330df45d02c7cc1c34ff Mon Sep 17 00:00:00 2001 From: majean5 Date: Fri, 10 Jun 2022 10:13:40 +0200 Subject: [PATCH] coucou fonctions experts --- Business/ManagerUsers.cs | 34 +++++++++++++++++++++++++++++++++ WpfApp1/App.xaml.cs | 2 -- WpfApp1/InfoUtilisateur.xaml.cs | 2 +- 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/Business/ManagerUsers.cs b/Business/ManagerUsers.cs index c813c2e..59e3b1f 100644 --- a/Business/ManagerUsers.cs +++ b/Business/ManagerUsers.cs @@ -79,6 +79,28 @@ namespace Business return true; } + + public bool AjouterExpert(Expert expert) + { + if (Experts.Contains(expert)) + { + return false; + + } + Experts.Add(expert); + return true; + } + + public bool SupprimerExpert(Expert expert) + { + if (!Experts.Contains(expert)) + { + return false; + } + Experts.Remove(expert); + return true; + } + public Personne GetUtilisateur(Personne user) { return Utilisateurs.SingleOrDefault(r => r.Equals(user)); @@ -96,5 +118,17 @@ namespace Business } + public bool ModifieExpert(Expert oldE, Expert newE) + { + if (!oldE.Equals(newE)) + { + return false; + } + Experts.Remove(oldE); + Experts.Add(newE); + return true; + } + + } } diff --git a/WpfApp1/App.xaml.cs b/WpfApp1/App.xaml.cs index c080c54..8e224db 100644 --- a/WpfApp1/App.xaml.cs +++ b/WpfApp1/App.xaml.cs @@ -17,8 +17,6 @@ namespace WpfApp1 { public static IPersistanceManager strat { get; private set; } = new DataContractPersistance(); - public static IPersistanceManager stubtruc { get; set; } - = new StubLib.Stub(); public Manager LeManager { get; private set; } = new Manager(strat); public ManagerUsers LeManagerUsers { get; private set; } = new ManagerUsers(strat); diff --git a/WpfApp1/InfoUtilisateur.xaml.cs b/WpfApp1/InfoUtilisateur.xaml.cs index 1a89576..bee9b80 100644 --- a/WpfApp1/InfoUtilisateur.xaml.cs +++ b/WpfApp1/InfoUtilisateur.xaml.cs @@ -62,7 +62,7 @@ namespace WpfApp1 private void exit_Click(object sender, RoutedEventArgs e) { - ((MainWindow)System.Windows.Application.Current.MainWindow).ContentControlSwapAcc(); + Close(); } private void deco_Click(object sender, RoutedEventArgs e)