private void DeleteAppointment() { bool converted = false; DateTime date; DBcontroler DB = new DBcontroler(); do { Console.Write("Old date of the appointment (dd-mm-yyyy): "); converted = DateTime.TryParse(Console.ReadLine(), out date); if (converted == false) { Console.WriteLine(); Console.WriteLine("Wrong input! Try again!"); Console.ReadKey(); Console.Clear(); } } while (converted == false); string phoneInput = TakingPhoneNumber(); DB.DeleteAppointment(phoneInput, date); Console.WriteLine("The appointment was deleted from the system!"); Console.ReadKey(); }
private void DeleteAppointment() { bool converted = false; string phoneInput = ""; bool inputCorrect = true; DateTime date; DBcontroler DB = new DBcontroler(); do { Console.Write("Old date of the appointment (dd-mm-yyyy): "); converted = DateTime.TryParse(Console.ReadLine(), out date); if (converted == false) { Console.WriteLine(); Console.WriteLine("Wrong input! Try again!"); Console.ReadKey(); Console.Clear(); } } while (converted == false); do { inputCorrect = false; Console.Clear(); Console.WriteLine("(Press x if you want to exit.)"); Console.WriteLine(); Console.Write("Customer's phone number for the appointment: "); phoneInput = Console.ReadLine(); if (phoneInput.ToLower() != "x") { inputCorrect = PhoneNumberChecking(phoneInput); } else { inputCorrect = true; } } while (inputCorrect == false); Console.Clear(); DB.DeleteAppointment(phoneInput, date); }