private void MakeReservation() { List <Site> availableSites = new List <Site>(); int campgroundId = CLIHelper.GetInteger("Which campground (ID number) would you like to reserve? Enter (0) to cancel."); if (campgroundId == 0) { return; } DateTime desiredStartDate = CLIHelper.GetDateTime("What is your desired arrival date? (__/__/____)"); DateTime desiredEndDate = CLIHelper.GetDateTime("What is your desired departure date? (__/__/____)"); SiteSqlDAL dal = new SiteSqlDAL(DatabaseConnection); List <Site> sites = dal.SearchReservation(campgroundId, desiredStartDate, desiredEndDate); decimal totalFee = dal.GetFee(campgroundId, desiredStartDate, desiredEndDate); if (sites.Count > 0) { Console.WriteLine("Results Matching Your Search Criteria"); Console.WriteLine("Site No.".PadRight(10) + "Max. Occup.".PadRight(15) + "Accessible?".PadRight(15) + "Max. RV Length".PadRight(15) + "Utility".PadRight(15) + "Cost"); sites.ForEach(s => { Console.WriteLine(s + " $" + Math.Round(totalFee, 2)); }); } else { Console.WriteLine("**** NO RESULTS ****"); return; } int siteNumber = CLIHelper.GetInteger("Which site would you like to reserve? (Enter 0 to cancel)"); //check out this fancy Linq thing that totally duplicates the commented-out stuff below int?tempSiteID = sites.First(s => s.SiteNumber == siteNumber)?.SiteID; //sites.ForEach(s => //{ // if (s.SiteNumber == siteNumber) // { // tempSiteID = s.SiteID; // } //}); if (siteNumber == 0) { return; } string reservationName = CLIHelper.GetString("What name should the reservation be made under?"); ReservationSqlDAL res = new ReservationSqlDAL(DatabaseConnection); bool result = res.MakeReservation(reservationName, tempSiteID, desiredStartDate, desiredEndDate); if (result) { Console.WriteLine($"Your reservation has been created under the name {reservationName}."); } else { Console.WriteLine("Error. Reservation not created. Please try again."); } }