public static (DateTime, DateTime) ValidateDates(DateTime startDate, DateTime endDate) { while (startDate.CompareTo(endDate) > 0) { Console.WriteLine("The end date is sooner then the start date, plase enter a new period" + "\n or type quit to go to main menu!"); Console.Write("Start Date (mm.dd.yyyy):"); var ans = Console.ReadLine(); if (ans.ToUpper() == "QUIT") { MenuPage.SelectOption(); } else { startDate = ValidateUserInput.ValidateInputDate(Console.ReadLine()); } Console.WriteLine("End Date (mm.dd.yyyy):"); ans = Console.ReadLine(); if (ans.ToUpper() == "QUIT") { MenuPage.SelectOption(); } else { endDate = ValidateUserInput.ValidateInputDate(Console.ReadLine()); } } return(startDate, endDate); }
public static int ValidateClient(int id) { using (var db = new RentCDb()) { while (!db.Customers.Any(c => c.CostumerID == id)) { Console.WriteLine("Client doesn't exist! Enter an existing client" + "\n or type quit to go to main menu!"); Console.WriteLine("Client:"); var ans = Console.ReadLine(); if (ans.ToUpper() == "QUIT") { MenuPage.SelectOption(); } else { id = ValidateUserInput.ValidateInputInt(Console.ReadLine()); } } return(id); } }