private void RemoveADoor(int badgeID) { Console.Write("Which door would you like to remove?"); string input = Console.ReadLine(); bool doorWasDeleted = _repo.RemoveDoorFromBadge(badgeID, input); if (doorWasDeleted) { Console.WriteLine("Door removed"); Console.ReadKey(); } else { Console.WriteLine("Door Could not be removed"); Console.ReadKey(); } }
public void UpdateABadge() { Console.Clear(); Console.WriteLine("What is the Badge ID of the badge you would like to change:"); int id = int.Parse(Console.ReadLine()); Badge badge = BadgesRepo.GetBadgeByIDNumber(id); if (badge != null) { Console.WriteLine($"{badge.BadgeID} has access to doors{badge.DoorNames}\n" + $"What would you like to do:\n" + $"1.Remove a door from this badge\n" + $"2.Add a door to this badge\n" + $"3.Go to the main menu"); int updateInput = int.Parse(Console.ReadLine()); if (updateInput == 1) { Console.WriteLine("Which door would you like to remove:"); string removeInput = Console.ReadLine().ToLower(); bool removed = BadgesRepo.RemoveDoorFromBadge(id, removeInput); if (removed == true) { Console.Clear(); Console.WriteLine($"The door was removed from the badge\n" + $"{badge.BadgeID} now has access to doors{badge.DoorNames}\n" + $"Hit enter to return to the main menu"); Console.ReadKey(); Menu(); } else { Console.Clear(); Console.WriteLine("The program was unable to remove the requested door\n" + "Hit enter to return to the main menu"); Console.ReadKey(); Menu(); } } else if (updateInput == 2) { Console.WriteLine("Please input the name of the door you would like to add to this badge:"); bool added = BadgesRepo.UpdateADoor(id, Console.ReadLine().ToUpper()); if (added == true) { Console.Clear(); Console.WriteLine($"The door was added to the badge\n" + $"{badge.BadgeID} now has access to doors{badge.DoorNames}\n" + $"Hit enter to return to the main menu"); Console.ReadKey(); Menu(); } else { Console.Clear(); Console.WriteLine("The program was unable to add the requested door\n" + "Hit enter to return to the main menu"); Console.ReadKey(); Menu(); } } else { Console.Clear(); Console.WriteLine("Returning you to the main menu, please hit enter."); Console.ReadKey(); Menu(); } } }
public void RemoveADoor_ShouldReturnTrue() { bool doorWasRemoved = _repo.RemoveDoorFromBadge(3345, "C3"); Assert.IsTrue(doorWasRemoved); }