Transformed expressions (foreach) into a LINQ + fixed the addUser method so that it adds a user (not permanently) to the list of users in UserBase
continuous-integration/drone/push Build is passing Details

pull/32/head
ImNicolasTheDev 2 years ago
parent 0ce9cdd5cb
commit cb49d29e8d

@ -273,9 +273,6 @@ void menuMontres()
return;
}
} while (choix != -1); // Tant que l'utilisateur n'appuie pas sur Echap
return;
}
//======================================= Fonctions d'affichage ============================================//
@ -344,12 +341,9 @@ void rechercheMonstre()
{
listCarac += carac.KeyChar;
}
else if (carac.Key == ConsoleKey.Backspace)
else if (carac.Key == ConsoleKey.Backspace && !string.IsNullOrEmpty(listCarac))
{
if (!string.IsNullOrEmpty(listCarac))
{
listCarac = listCarac.Remove(listCarac.Length - 1, 1);
}
listCarac = listCarac.Remove(listCarac.Length - 1, 1);
}
Console.Write(listCarac);

@ -57,13 +57,14 @@ namespace Model
{
return false;
}
foreach (User u in ListUsers)
foreach (var _ in from User u in ListUsers
where username.Equals(u.Pseudo)
select new { })
{
if (username.Equals(u.Pseudo))
{
return true;
}
return true;
}
return false;
}
@ -74,7 +75,8 @@ namespace Model
{
return false;
}
User user = new User(pseudo, nom, prenom, pssw); //POUR L'INSTANT -> Ne peux pas ajouter dans le stub
User user = new User(pseudo, nom, prenom, pssw); //POUR L'INSTANT, de manière non permanente
ListUsers.Add(user);
return true;
}
}

Loading…
Cancel
Save