Example #1
0
        /// <summary>
        /// Display Campground list for selected Park
        /// </summary>
        /// <param name="park">Park object</param>
        /// <returns>List of campground objects</returns>
        private List <Campground> DisplayCampgroundInfo(Park park)
        {
            CampgroundSqlDAL campgroundSqlDAL = new CampgroundSqlDAL(_connectionString);

            PrintHeader();
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("Park Campgrounds");
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine($"{park.Name} Campgrounds");
            Console.WriteLine();
            Console.WriteLine("     Name".PadRight(40) + "Open".PadRight(10) + "Close".PadRight(10) + " Daily Fee");
            List <Campground> campList = campgroundSqlDAL.GetCampgroundsInPark(park);

            for (int i = 1; i <= campList.Count; i++)
            {
                Console.WriteLine($"#{i.ToString().Trim().PadRight(4)}" +
                                  $"{campList[i - 1].Name.PadRight(35)}" +
                                  $"{_monthNames[campList[i - 1].OpenFromMonth - 1].PadRight(10)}" +
                                  $"{_monthNames[campList[i - 1].OpenToMonth - 1].PadRight(10)} " +
                                  $"{campList[i - 1].DailyFee.ToString("C2").PadLeft(9)}");
            }
            return(campList);
        }