예제 #1
0
        //Method to Add Outings//
        private void AddOuting()
        {
            // OutingType, Date, NoOfPEople, Total Cost Per Person, Total Cost Event

            Console.Clear();
            Console.WriteLine("Press enter to Add a new outing.");
            Console.ReadKey();

            Console.WriteLine("What did you do on the Outing?\n" +
                              "1. Golf \n" +
                              "2. Bowling \n" +
                              "3. Amusement Park \n" +
                              "4. Concert \n");
            int input = ParseInput();

            OutingType type;

            switch (input)
            {
            default:
            case 1:
                type = OutingType.Golf;
                break;

            case 2:
                type = OutingType.Bowling;
                break;

            case 3:
                type = OutingType.AmmusmentPark;
                break;

            case 4:
                type = OutingType.Concert;
                break;
            }

            Console.WriteLine("What was the date of the trip? (MM/DD/YY)");
            string date = Console.ReadLine();

            Console.WriteLine("How many people attended?");
            int numberOfPeople = int.Parse(Console.ReadLine());

            Console.WriteLine($"What was the cost per person?");
            decimal totalCostPerPerson = decimal.Parse(Console.ReadLine());

            Console.WriteLine("What was the total cost of the event?");
            decimal totalCostByEvent = decimal.Parse(Console.ReadLine());

            OutingInfo newOuting = new OutingInfo(type, numberOfPeople, date, totalCostPerPerson, totalCostByEvent);

            _outingRepo.AddOutingToList(newOuting);

            Console.WriteLine("This Outing has been added to the database. press enter to return to menu.");
            Console.ReadKey();
        }
 public void AddOutingToList(OutingInfo newOuting)
 {
     _outings.Add(newOuting);
 }