static void Main(string[] args) { Settings(); string connectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString; SqlConnection connection = new SqlConnection(connectionString); FormController controller = new FormController(connection); View view = new View(controller); view.Process(); }
/// <summary> /// Create Reservations instance from inputs data. /// </summary> /// <returns></returns> public static Reservations ReservationForm(FormController controller) { Console.Clear(); int customerId = 0; string location = null; DateTime startDate; DateTime endDate; controller.CustomerIdToLocation(ref customerId, ref location); int carId = controller.CarPlateToCarId(); controller.CheckIfCarAvailableAtLocation(ref carId, ref location); do { Console.WriteLine("Enter Start date"); startDate = Utility.InputAndValidatDateTime(); } while (!Utility.CheckIfCorrectDate(startDate)); do { Console.WriteLine("Enter End date"); endDate = Utility.InputAndValidatDateTime(); } while (!Utility.CheckIfEndDateIsCorrect(startDate, endDate)); Reservations reservation = new Reservations { CustomerID = customerId, CarID = carId, StartDate = startDate, EndDate = endDate, Location = location, ReservStatsID = 1 }; return(reservation); }