示例#1
0
        private void AddNewBadge()
        {
            BadgeProp badge = new BadgeProp();

            badge.DoorList = new List <string>();
            bool   isAdding = true;
            string yesNo;

            Console.WriteLine("What is the Badge ID number");
            badge.BadgeNumber = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("What door access do you want to add?(One door at a time)");
            badge.DoorList.Add(Console.ReadLine());


            // _repoDirectory.NewListOfDoors(badge, doorNum);

            while (isAdding)
            {
                Console.WriteLine("Do you want to add another door? Y/N");
                yesNo = Console.ReadLine();

                if (yesNo == "yes" || yesNo == "y")
                {
                    Console.WriteLine("What door do you want to add?(One door at a time)");
                    badge.DoorList.Add(Console.ReadLine());
                }
                else
                {
                    _repoDirectory.AddNewBadge(badge);
                    isAdding = false;
                }
            }
        }
示例#2
0
        public bool AddNewBadge(BadgeProp badge)
        {
            int directLengh = _keyCardDirectory.Count();
            Dictionary <int, List <string> > currentContent = _keyCardDirectory;

            currentContent.Add(badge.BadgeNumber, badge.DoorList);
            bool wasAdd = directLengh + 1 == _keyCardDirectory.Count();

            return(wasAdd);
        }
示例#3
0
        private void Seed()
        {
            List <string> listOne = new List <string> {
                "A7", "A4", "A2"
            };
            List <string> listTwo = new List <string> {
                "A55", "A22", "A8"
            };
            BadgeProp one = new BadgeProp(12345, listOne);

            _repoDirectory.AddBadge(one);
            BadgeProp two = new BadgeProp(54321, listTwo);

            _repoDirectory.AddBadge(two);
        }
示例#4
0
 public void AddBadge(BadgeProp badge)
 {
     _badgeDirectory.Add(badge);
 }