public static void LoginAsStudent(List <Person> members) { Person loggedInStudent = LoginMenu.LoginVerification(members); if (loggedInStudent == null) { Console.Clear(); Console.WriteLine("\nSorry, no such student. Maybe you just misspelled your username and\\or password?\n" + "In any case, please try again."); LoginMenu.PressAnyKey(); return; } loggedInStudent.PrintInfo(); LoginMenu.PressAnyKey(); }
public static void LoginAsAdmin(List <Person> members, List <Admin> admins, List <Trainer> trainers, List <Student> students) { Person loggedInAdmin = LoginMenu.LoginVerification(members); if (loggedInAdmin == null) { Console.Clear(); Console.WriteLine("\nSorry, no such administrator. Maybe you just misspelled your username and\\or password?\n" + "In any case, please try again."); LoginMenu.PressAnyKey(); return; } Console.Clear(); Console.Write($"\nWelcome Admin "); loggedInAdmin.PrintInfo(); AdminMenu(members, admins, trainers, students, loggedInAdmin); }
public static Tuple <List <Person>, List <Admin>, List <Trainer>, List <Student> > RemoveAMember(List <Person> members, List <Admin> admins, List <Trainer> trainers, List <Student> students, Admin loggedInAdmin) { Console.Clear(); Console.WriteLine("\nWould you like to remove:\n" + "[1] An Admin\n" + "[2] A Trainer\n" + "[3] A Student"); int adminChoice = int.Parse(Console.ReadLine()); switch (adminChoice) { case 1: Person adminToRemove = LoginMenu.LoginVerification(members); if (adminToRemove == null) { Console.Clear(); Console.WriteLine("\nSorry, no such admin. Please try again."); LoginMenu.PressAnyKey(); Console.Clear(); break; } if (adminToRemove == loggedInAdmin) { Console.Clear(); Console.WriteLine("\nCan't remove yourself"); LoginMenu.PressAnyKey(); Console.Clear(); break; } Console.Clear(); Console.Write($"\nSuccessfully removed admin "); adminToRemove.PrintInfo(); members.Remove(adminToRemove); admins.Remove((Admin)adminToRemove); LoginMenu.PressAnyKey(); Console.Clear(); break; case 2: Person trainerToRemove = LoginMenu.LoginVerification(members); if (trainerToRemove == null) { Console.Clear(); Console.WriteLine("\nSorry, no such trainer. Please try again."); LoginMenu.PressAnyKey(); break; } Console.Clear(); Console.Write($"\nSuccessfully removed trainer "); trainerToRemove.PrintInfo(); members.Remove(trainerToRemove); trainers.Remove((Trainer)trainerToRemove); LoginMenu.PressAnyKey(); Console.Clear(); break; case 3: Person studentToRemove = LoginMenu.LoginVerification(members); if (studentToRemove == null) { Console.Clear(); Console.WriteLine("\nSorry, no such student. Please try again."); LoginMenu.PressAnyKey(); break; } Console.Clear(); Console.Write($"\nSuccessfully removed student {studentToRemove.FirstName} {studentToRemove.LastName}"); members.Remove(studentToRemove); students.Remove((Student)studentToRemove); LoginMenu.PressAnyKey(); Console.Clear(); break; default: Console.Clear(); Console.WriteLine($"\nNo such option. Please try again."); LoginMenu.PressAnyKey(); AdminMenu(members, admins, trainers, students, loggedInAdmin); break; } return(new Tuple <List <Person>, List <Admin>, List <Trainer>, List <Student> >(members, admins, trainers, students)); }