/// <summary> /// The override of ExecuteSelection handles whatever selection was made by the user. /// This is where any business logic is executed. /// </summary> /// <param name="choice">"Key" of the user's menu selection</param> /// <returns></returns> protected override bool ExecuteSelection(string choice) { switch (choice) { case "1": // Do whatever option 1 is int campgroundChoice = CLIMenu.GetInteger($"Which Campground?"); if (campgroundChoice > 0 && campgroundChoice <= park.Campgrounds.Count) { Campground campground = park.Campgrounds[campgroundChoice - 1]; campground.Sites = siteDao.GetSiteId(campground.CampgroundId); string arrivalDate = CLIMenu.GetString("What is your arrival date? (yyyy-mm-dd)"); string departureDate = CLIMenu.GetString("What is your departure date?(yyyy-mm-dd)"); SiteMenu siteMenu = new SiteMenu(park, campground, siteDao, reservationDao, arrivalDate, departureDate); siteMenu.Run(); } else { Console.WriteLine("That campsite is not in our database."); } Pause(""); return(true); case "2": // Do whatever option 2 is WriteError("When this option is complete, we will exit this submenu by returning false from the ExecuteSelection method."); Pause(""); return(false); } return(true); }
protected override bool ExecuteSelection(string choice) { IList <Campground> campgrounds = campgroundDAO.GetCampgroundsByParkId(parkSelection.ParkId); SiteMenu menu = new SiteMenu(campgrounds, parkSelection, parkDAO, campgroundDAO, reservationDAO, siteDAO); menu.Run(); return(true); }