public void NotifyObservers(SubjectEvent subjectEvent) { foreach (var observer in _observers) { observer.Update(subjectEvent); } }
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); }
public void AddProduct() { //aca va la logica de agregado de productos SubjectEvent subjectEvent = new SubjectEvent { EventType = "Tipo de evento", EventDate = DateTime.Now }; NotifyObservers(subjectEvent); }