예제 #1
0
        // Update: update door access on an existing badge by name
        public bool UpdateExistingBadge(string originalName, BadgeClass newInfo)
        {
            //find the content
            BadgeClass oldInfo = GetBadgeByName(originalName);

            //update the content
            if (oldInfo != null)
            {
                oldInfo.Door = newInfo.Door;

                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #2
0
        // Delete: delete all doors from an existing badge
        public bool RemoveDoorsFromList(string door)
        {
            BadgeClass badge = GetBadgeByName(door);

            if (badge == null)
            {
                return(false);
            }

            int initialCount = _listOfBadges.Count;

            _listOfBadges.Remove(badge);

            if (initialCount > _listOfBadges.Count)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #3
0
 // Create: add new door to list
 public void AddDoorToList(BadgeClass ldoors)
 {
     _listOfDoors.Add(ldoors);
 }
예제 #4
0
        private List <BadgeClass> _listOfDoors  = new List <BadgeClass>(); // door list

        //Dictionaries
        //Dictionary<char, string> keyValuePair = new Dictionary<char, string>();
        //keyValuePair.Add('j', "Josh");

        // Create: add new badge to list
        public void AddBadgeToList(BadgeClass badge)
        {
            _listOfBadges.Add(badge);
        }