Exemple #1
0
 public void NotifyObservers(SubjectEvent subjectEvent)
 {
     foreach (var observer in _observers)
     {
         observer.Update(subjectEvent);
     }
 }
Exemple #2
0
 public void Update(SubjectEvent subjectEvent)
 {
     Console.WriteLine("");
     Console.WriteLine("An event just happened!");
     Console.WriteLine("Event type: " + subjectEvent.EventType);
     Console.WriteLine("Event date: " + subjectEvent.EventDate);
 }
Exemple #3
0
        public void AddProduct()
        {
            //aca va la logica de agregado de productos

            SubjectEvent subjectEvent = new SubjectEvent {
                EventType = "Tipo de evento", EventDate = DateTime.Now
            };

            NotifyObservers(subjectEvent);
        }