示例#1
0
        // Update Door Access
        private void UpdateBadge()
        {
            Console.Clear();
            // BadgeID
            Console.WriteLine("Enter the badge number:");
            string      badgeNumberAsString = Console.ReadLine();
            BadgeAccess badge = _badgeRepo.GetBadgeById(int.Parse(badgeNumberAsString));

            Console.WriteLine($"{badge.BadgeID} has access to doors {badge.DoorNumber}.");

            Console.WriteLine("How would you like to proceed?\n" +
                              "1. Remove Door\n" +
                              "2. Add Door");

            string input = Console.ReadLine();

            switch (input)
            {
            case "1":
                Console.WriteLine("Which door would you like to remove?");
                string doorRemoval = Console.ReadLine();
                _badgeRepo.RemoveDoorAccess(badge.BadgeID, doorRemoval);
                break;

            case "2":
                Console.WriteLine("Which door would you like to add?");
                string doorAddition = Console.ReadLine();
                _badgeRepo.AddDoorAccess(badge.BadgeID, doorAddition);
                break;

            default:
                Console.WriteLine("Please enter a valid option.");
                break;
            }
        }
示例#2
0
        // Create New Badge
        public void CreateNewBadge()
        {
            Console.WriteLine("Enter the number of the badge:");
            string badgeIDAsString = Console.ReadLine();
            int    badgeIDToINT    = int.Parse(badgeIDAsString);

            Console.WriteLine("List the door that this badge has access:");
            string doorNumber = Console.ReadLine();

            BadgeAccess newBadge = _badgeRepo.CreateNewBadgeAccess(badgeIDToINT, doorNumber);

            // Additional Doors
            Console.WriteLine("Grant access to other doors? (y/n)");
            string additionalDoorToString = Console.ReadLine().ToLower();

            if (additionalDoorToString == "y")
            {
                Console.WriteLine("Enter the door you'd like to add to this badge:");
                string doorNumberAsString = Console.ReadLine();
                newBadge.DoorNumber.Add(badgeIDAsString);
            }
            else
            {
                Menu();
            }
        }