protected virtual void OnCateringEvent(CateringOrder order, Flight flight) { CateringEvent?.Invoke(this, new CateringEventArgs { Flight = flight, Order = order }); }
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}"); }