// 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); } }
// 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); } }
// Create: add new door to list public void AddDoorToList(BadgeClass ldoors) { _listOfDoors.Add(ldoors); }
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); }