Exemplo n.º 1
0
        /// <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. You may prompt the user for more information
                          // (using the Helper methods), and then pass those values into some
                          //business object to get something done.
                ListAllParks();
                parkId = GetInteger("Please select the park number: ");
                Park park = parkDAO.GetParkById(parkId);
                //Find if the park exists
                if (park == null)
                {
                    Pause($"Sorry park {parkId} does not exist");
                    return(true);
                }
                //Code was found go into  the park menu
                ParkSubMenu submenu = new ParkSubMenu(park, campground, site, reservation, parkDAO, campgroundDAO, siteDAO, reservationDAO);
                submenu.Run();
                return(true);

            //case "2": // Do whatever option 2 is
            //    string name = GetString("What is your name?");
            //    WriteError($"Not yet implemented, {name}.");
            //    Pause("");
            //    return true;    // Keep running the main menu
            case "2":
                // Create and show the sub-menu
                //SubMenu1 sm = new SubMenu1();
                //sm.Run();
                return(true);       // Keep running the main menu
            }
            return(true);
        }
Exemplo n.º 2
0
        public IActionResult Detail(string parkCode)
        {
            Park park = parkDAO.GetParkById(parkCode);

            return(View(park));
        }