public void Execute(AppointmentRescheduled @event) { Printer.Print("Updating JobView in effect of AppointmentRescheduled event", ConsoleColor.Magenta); var jobViewRepository = new MyRepository <JobView>(); var jobView = jobViewRepository.FetchAll().Single(j => j.Appointments.Any(a => a.Id == @event.AppointmentId)); jobView.Appointments.Single(a => a.Id == @event.AppointmentId).From = @event.From; jobView.Appointments.Single(a => a.Id == @event.AppointmentId).To = @event.To; jobViewRepository.Update(jobView); Publish(jobView); }
public void Handle(AppointmentRescheduled @event) { TimeSlot = new TimeSlot(@event.From, @event.To); }