Exemple #1
0
        public void Seed()
        {
            Challenge3Badges badgeOne = new Challenge3Badges(12345, new List <string> {
                "A7"
            });
            Challenge3Badges badgeTwo = new Challenge3Badges(22345, new List <string> {
                "A1", "A4", "B1", "B2"
            });
            Challenge3Badges badgeThree = new Challenge3Badges(32345, new List <string> {
                "A4", "A5"
            });

            _repo.AddBadgeToDictionary(badgeOne);
            _repo.AddBadgeToDictionary(badgeTwo);
            _repo.AddBadgeToDictionary(badgeThree);
        }
Exemple #2
0
        public void AddBadge()
        {
            Console.Clear();
            Console.WriteLine("What is the number on the badge?");
            int badgeNumber = Convert.ToInt32(Console.ReadLine());

            Console.Clear();

            List <string> doorlist = new List <string>();

            Console.WriteLine("List a door that it needs access to:\n");
            doorlist.Add(Console.ReadLine());
            bool addAnother = true;

            while (addAnother)
            {
                Console.WriteLine("Any other doors? Y/N:");
                char response = Console.ReadKey().KeyChar;

                if (response == 'y')
                {
                    Console.WriteLine("\n");
                    Console.WriteLine("List a door it needs access to:");
                    doorlist.Add(Console.ReadLine());
                    Console.Clear();
                }
                else
                {
                    addAnother = false;
                }
            }

            Challenge3Badges newBadge = new Challenge3Badges(badgeNumber, doorlist);

            _repo.AddBadgeToDictionary(newBadge);
        }