private void AddBadge() { Dictionary <int, List <string> > dictOfBadges = _badgeRepo.GetBadge(); List <string> listOfDoors = _badgeRepo.GetDoorList(); Console.Clear(); Console.WriteLine("Enter your badge ID number: (ex. 1, 9, 13, 256)"); int badgeID = int.Parse(Console.ReadLine()); Console.WriteLine(); Console.WriteLine("Do you want to add a door to this badge? (y/n)"); var input = Console.ReadLine().ToLower(); bool addingDoor = _badgeRepo.CheckAnswer(input); while (addingDoor) { Console.WriteLine(); Console.WriteLine("Enter the letter(s) and number(s) for a single door: (ex. a1, bg15, zd192)"); var doorName = Console.ReadLine(); _badgeRepo.AddBadgeDoor(doorName); Console.WriteLine(); Console.WriteLine("Do you want to add another door? (y/n)"); var newinput = Console.ReadLine().ToLower(); addingDoor = _badgeRepo.CheckAnswer(newinput); } Badge newBadge = new Badge(badgeID, listOfDoors); _badgeRepo.AddBadge(newBadge); Console.WriteLine(); }
private void UpdateDoor() { Dictionary <int, List <string> > badgeID = _iDRepo.GetBadge(); List <string> listOfDoors = _iDRepo.GetList(); Console.Clear(); Console.Write("Current badges: "); foreach (KeyValuePair <int, List <string> > IdNumber in _iDRepo.GetBadge()) { Console.Write($" {IdNumber.Key}\n"); } //Console.WriteLine(); Console.Write("\nBe aware that all doors Assigned to this Badge # will be delete.\n" + "Do you want to continue? (y/n):"); var input = Console.ReadLine().ToLower(); if (input != "y") { return; } Console.WriteLine(); { Console.Write("\nEnter Badge #: "); int badgeid = int.Parse(Console.ReadLine()); foreach (KeyValuePair <int, List <string> > IdNumber in _iDRepo.GetBadge()) { if (badgeid == IdNumber.Key) { //Console.WriteLine(); Console.Write("\nThis Badge currently has no doors assigned. Do you want to add a door to this badge? (y/n): "); var dooranswer = Console.ReadLine().ToLower(); bool addingdoors = _iDRepo.CheckAnswer(dooranswer); while (addingdoors) { //Console.WriteLine(); Console.WriteLine("\nEnter door name(s) ex:(A2,A3 or A1,golden,blue:"); var doorname = Console.ReadLine(); _iDRepo.AddDoorToList(doorname); //Console.WriteLine(); Console.Write("Do you want to add another door? (y/n): "); var answer = Console.ReadLine().ToLower(); addingdoors = _iDRepo.CheckAnswer(answer); } } else { return; } } badgeID[badgeid] = listOfDoors; Console.WriteLine(); } }