Пример #1
0
        public void Run()
        {
            Outing topGolf     = new Outing(OutingType.Golf, 10, new DateTime(2019, 02, 14), 20.00m, 200.00m);
            Outing shinedown   = new Outing(OutingType.Concert, 5, new DateTime(2017, 05, 16), 30.00m, 150.00m);
            Outing disneyWorld = new Outing(OutingType.AmusementPark, 3, new DateTime(2017, 06, 15), 100.00m, 300m);

            _outingRepo.AddOutingToList(topGolf);
            _outingRepo.AddOutingToList(shinedown);
            _outingRepo.AddOutingToList(disneyWorld);

            bool isRunning = true;

            while (isRunning)
            {
                Console.Clear();
                Console.WriteLine("Welcome to the Company Outings Page. Please choose one of the following options:" +
                                  "\n\t1. See list of all of the Outings" +
                                  "\n\t2. Add an Outing" +
                                  "\n\t3. See the total cost of all the Outings" +
                                  "\n\t4. See the total cost of an Outing type" +
                                  "\n\t5. Exit Program");
                int input = int.Parse(Console.ReadLine());
                switch (input)
                {
                case 1:
                    SeeListOfOutings();
                    break;

                case 2:
                    AddOutingToList();
                    break;

                case 3:
                    Console.Clear();
                    Console.WriteLine($"The total cost for all of the outings is {_outingRepo.CalculateTotalCost():c}");
                    Console.ReadKey();
                    break;

                case 4:
                    OutingCostByType();
                    break;

                case 5:
                    Console.Clear();
                    Console.WriteLine("Are you sure you want to exit the program? y/n");
                    string answer = Console.ReadLine().ToLower();
                    if (answer == "y")
                    {
                        isRunning = false;
                        Console.WriteLine("Good Bye");
                        Console.Read();
                    }
                    else
                    {
                        isRunning = true;
                    }
                    break;

                default:
                    Console.WriteLine("We entered an invalid selection. Please choose a valid option");
                    break;
                }
            }
        }