public static int ValidateIntegerResponse(string promptMessage, string userResponse) { int userResponseInteger = 0; while (!(int.TryParse(userResponse, out userResponseInteger))) { ConsoleView.DisplayReset(); ConsoleView.DisplayMessage(""); ConsoleView.DisplayMessage("It appears you have not entered a valid integer."); ConsoleView.DisplayMessage(""); ConsoleView.DisplayPromptMessage(promptMessage); userResponse = Console.ReadLine(); } return(userResponseInteger); }
private static void DeleteFirearm() { FirearmRepositorySQL firearmRepository = new FirearmRepositorySQL(); List <Firearm> firearms = firearmRepository.SelectAll(); Firearm firearm = new Firearm(); int firearmID; string message; firearmID = ConsoleView.GetFirearmID(firearms); using (firearmRepository) { firearmRepository.Delete(firearmID); } ConsoleView.DisplayReset(); message = String.Format("Firearm ID: {0} had been deleted.", firearmID); ConsoleView.DisplayMessage(message); ConsoleView.DisplayContinuePrompt(); }