private void PrintMainMenu() { Console.WriteLine(); bool validChoice = true; while (validChoice) { Console.WriteLine("Welcome to the Libarary!"); Console.WriteLine("1. Show Library Collection\n2. Search for Item\n3. Check out item\n4. Check in item\n5. Exit"); int userSelection = session.GetValidInput(session.GetUserInput("Please choose from an option above: "), 1, 5); Console.Clear(); validChoice = false; switch (userSelection) { case 1: ListItems(); break; case 2: SearchForItem(); break; case 3: CheckOutItem(); break; case 4: CheckInItem(); break; case 5: ExitProgram(); break; default: validChoice = true; Console.WriteLine("Please make a valid selection (1 - 4)."); break; } } }
private void CheckInItem() //will need a 'List<Item> libraryList' parameter { ValidatorClass session = new ValidatorClass(); //do stuff // probably print the list of items that checked in Console.WriteLine("\nHere's the list of currently checked out items:"); int count = 1; Dictionary <int, string> tempDict = new Dictionary <int, string>(); foreach (Item item in libraryList) { if (item.CheckedIn == false) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine($"{count}: {item.Title}"); Console.ResetColor(); tempDict.Add(count, item.Title); count++; } } int choice = session.GetValidInput("\nWhich item would you like to check out?", 1, count - 1); bool gotValue = tempDict.TryGetValue(choice, out string title); foreach (var item in libraryList) { if (item.Title == title) { item.CheckedIn = true; SetItemDueDate(item); } } UserContinue(); }