Example #1
0
 protected virtual void OnCateringEvent(CateringOrder order, Flight flight)
 {
     CateringEvent?.Invoke(this, new CateringEventArgs {
         Flight = flight, Order = order
     });
 }
Example #2
0
        public void PlaceOrder(string airport, int numberOfMeals, DateTime cateringDate, Flight flight)
        {
            CateringOrder order = new CateringOrder(airport, numberOfMeals, cateringDate);

            if (orders.ContainsKey(airport))
            {
                orders[airport].Add(order);
            }
            else
            {
                orders.Add(airport, new List <CateringOrder>()
                {
                    order
                });
            }
            OnCateringEvent(order, flight);
            Console.WriteLine($"Ordering {numberOfMeals} meals in {airport}");
        }