static void Main(string[] args) { // Calling the seed method in order to fill in the database with inital data if it is empty Seed(); while (true) { // If it is null, it means that nobody is logged in // We can generate the menu for log in if (_currentUser == null) { // Menu for log in or register // Program -> Log in Menu method -> Generate a new menu method -> Validate a number // Validate a number -> Generate a new menu mehod -> Log in Menu method -> Program int loginChoice = _uiSrvc.LogInMenu(); // This if checks if the number the user entered is 1. If it is give them log in menu if (loginChoice == 1) { // Menu for the user role if they want to log in int roleChoice = _uiSrvc.RoleMenu(); // We map the user choice of 1 2 or 3 to the enum so we can have it as an enum UserRole role = (UserRole)roleChoice; // UserRole brokenRole = UserRole.1; // This will not work // UserRole standard = (UserRole)1; // This will work and will get the Standard enum since it is number 1 in the enum Console.Clear(); // Give the log in menu if they want to log in Console.WriteLine("Enter username:"******"Enter password:"******"Enter first name:"); newUser.FirstName = Console.ReadLine(); Console.WriteLine("Enter last name:"); newUser.LastName = Console.ReadLine(); Console.WriteLine("Enter username:"******"Enter password:"******"Train": // We have 2 kinds of training: Video and Live // But standard users only have access to Video and not Live, while Premium have access to both // Because this is the case we set the default choice to 1, which corelates to Video Trainings // IF the user is premium we give them a choice to pick Live or Video and then change the choice accordingly int trainChoice = 1; if (_currentUser.Role == UserRole.Premium) { trainChoice = _uiSrvc.TrainMenu(); } // Video trainings if (trainChoice == 1) { int trainingItem = _uiSrvc.TrainMenuItems(_videoTrainings.GetTrainings()); VideoTraining training = _videoTrainings.GetTrainings()[trainingItem - 1]; Console.WriteLine(training.Title); Console.WriteLine($"Link: {training.Link}"); Console.WriteLine($"Raiting: {training.CheckRating()}"); Console.WriteLine($"Time: {training.Time} minutes"); Console.ReadLine(); } // Live trainings if (trainChoice == 2) { int trainingItem = _uiSrvc.TrainMenuItems(_liveTrainings.GetTrainings()); LiveTraining training = _liveTrainings.GetTrainings()[trainingItem - 1]; Console.WriteLine(training.Title); Console.WriteLine($"THE TRAINING STARTS AT: {training.NextSession}"); Console.WriteLine($"Raiting: {training.CheckRating()}"); Console.WriteLine($"Time: {training.Time} minutes"); Console.ReadLine(); } break; case "Upgrade to Premium": _uiSrvc.UpgradeToPremium(); break; case "Reschedule training": List <LiveTraining> trainings = _liveTrainings.GetTrainings().Where(x => x.Trainer.Id == _currentUser.Id).ToList(); if (trainings.Count == 0) { Console.WriteLine("No Trainings!"); Console.ReadLine(); } else { int trainingChoice = _uiSrvc.ChooseEntiiesMenu(trainings); Console.WriteLine("How many days do you want to reschedule the training:"); int days = ValidationHelper.ValidateNumber(Console.ReadLine(), 100); _trainerUserSrvc.GetUserById(_currentUser.Id).ChangeSchedule(trainings[trainingChoice - 1], days); Console.WriteLine("Schedule changed!"); Console.ReadLine(); } break; case "Account": int accountChoice = _uiSrvc.AccountMenu(_currentUser.Role); Console.Clear(); if (accountChoice == 1) { // Change Info Console.WriteLine("Enter new First Name:"); string firstName = Console.ReadLine(); Console.WriteLine("Enter new Last Name:"); string lastName = Console.ReadLine(); switch (_currentUser.Role) { case UserRole.Standard: _standardUserSrvc.ChangeInfo(_currentUser.Id, firstName, lastName); break; case UserRole.Premium: _premiumUserSrvc.ChangeInfo(_currentUser.Id, firstName, lastName); break; case UserRole.Trainer: _trainerUserSrvc.ChangeInfo(_currentUser.Id, firstName, lastName); break; } } else if (accountChoice == 2) { // Check Subscription Console.WriteLine($"Your subscription is: {_currentUser.Role}"); Console.ReadLine(); } else if (accountChoice == 3) { // Change info Console.WriteLine("Enter old password:"******"Enter new password:"******"Log Out": _currentUser = null; break; default: break; } } }