From 266afd86767d47d92c13f8f589533054ec46836d Mon Sep 17 00:00:00 2001 From: Yannis DOUMIR FERNANDES Date: Fri, 28 Apr 2023 12:01:20 +0200 Subject: [PATCH] ajout searchpage dans cs --- Console/Program.cs | 27 ++++++++++++++++++++++++-- Console/Properties/launchSettings.json | 11 +++++++++++ Modèle/UserBase.cs | 7 +++++-- 3 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 Console/Properties/launchSettings.json diff --git a/Console/Program.cs b/Console/Program.cs index 6785ad4..6e44b75 100644 --- a/Console/Program.cs +++ b/Console/Program.cs @@ -54,10 +54,11 @@ int menuPrincipal(){ { Console.Clear(); Console.WriteLine("Choix 3"); + searchPage(); return 3; } else { - Console.WriteLine("Écris un nombre compris entre 1 et 3"); + Console.WriteLine("Écris un nombre compris entre 1 et 3"); // Pq ? il écrit ça à chaque fin de prog } return 0; } @@ -92,7 +93,8 @@ string ReadPassword() info = Console.ReadKey(true); } // Ajoute un alinéa parce que l'utlisateur a validé - Console.WriteLine(); + Console.WriteLine("Vous arrivez sur la page d'accueil"); + searchPage(); return psswrd; } int menuConnexion() @@ -124,4 +126,25 @@ int menuConnexion() return 0; } +int searchPage() +{ + Console.WriteLine("Bienvenue sur la page d'accueil"); + Console.WriteLine("1 - Déconnexion"); + string? choix; + choix = Console.ReadLine(); + if ( choix == "1") + { + menuPrincipal(); + + return 1; + } + + else + { + Console.WriteLine("Entrer un chiffre correct"); + searchPage(); + } + return 0; +} + int codeRetour = menuPrincipal(); \ No newline at end of file diff --git a/Console/Properties/launchSettings.json b/Console/Properties/launchSettings.json new file mode 100644 index 0000000..65dc712 --- /dev/null +++ b/Console/Properties/launchSettings.json @@ -0,0 +1,11 @@ +{ + "profiles": { + "Console": { + "commandName": "Project" + }, + "WSL": { + "commandName": "WSL2", + "distributionName": "" + } + } +} \ No newline at end of file diff --git a/Modèle/UserBase.cs b/Modèle/UserBase.cs index bc0829d..f4ecff6 100644 --- a/Modèle/UserBase.cs +++ b/Modèle/UserBase.cs @@ -25,12 +25,14 @@ namespace Modèle { ListUsers = new Stub().loadUsers(); } - + + + public int checkIfExists(string username, string password) { foreach (User u in ListUsers) { - if(username.Equals(u.Pseudo) && password.Equals(u.Mdp)) + if (username.Equals(u.Pseudo) && password.Equals(u.Mdp)) { Console.WriteLine($"Bienvenue, {u.Pseudo}, vous venez de vous connecter!"); return 1; @@ -38,5 +40,6 @@ namespace Modèle } return 0; } + } } \ No newline at end of file