public bool AddBadgeToDirectory(Badges item) { int startingCount = _badgeDirectory.Count; _badgeDirectory.Add(item.BadgeId, item.Doors); bool wasAdded = _badgeDirectory.Count == startingCount + 1; return(wasAdded); }
public void CreateNewBadge() { Console.Clear(); Console.WriteLine("Enter a Badge ID:"); int badgeId = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Enter accessible doors:"); string accessibleDoors = Console.ReadLine(); List <string> list = new List <string>(); list.Add(accessibleDoors); string[] newBadgeDoors = list.ToArray(); Badges newBadge = new Badges(badgeId, newBadgeDoors); badge_Repo.AddBadgeToDirectory(newBadge); Console.WriteLine("Badge has been created! Press any key to continue"); }