Пример #1
0
        private void UpdateABadge()
        {
            Console.WriteLine("What is the badge number to update?");
            string badgeAsString = Console.ReadLine();
            int    badgeID       = int.Parse(badgeAsString);

            List <string> whatAccessDoorIDHas = _badgeRepo.DoorByID(badgeID);

            Console.WriteLine(_badgeRepo.DisplayDoorAccess(badgeID));
            Console.WriteLine("What would you like to do?\n" +
                              "1. Remove a door\n" +
                              "2. Add a door");
            int userInput = int.Parse(Console.ReadLine());

            switch (userInput)
            {
            case 1:
            {
                Console.WriteLine("Which door would you like to remove?");
                string removeDoor = Console.ReadLine();
                _badgeRepo.DeleteAccess(badgeID, removeDoor);
                Console.WriteLine(_badgeRepo.DisplayDoorAccess(badgeID));
                Console.WriteLine("Press any key to continue.");
                Console.ReadKey();
                break;
            }

            case 2:
            {
                Console.WriteLine("Which door would you like to add?");
                string addDoor = Console.ReadLine();
                _badgeRepo.DoorAccess(badgeID, addDoor);
                Console.WriteLine(_badgeRepo.DisplayDoorAccess(badgeID));
                Console.WriteLine("Press any key to continue.");
                Console.ReadKey();
                break;
            }

            default:
            {
                Console.WriteLine("Please enter a valid response.");
                Console.ReadKey();
                break;
            }
            }
        }