Exemplo n.º 1
0
        public void Execute(AppointmentCompleted @event)
        {
            Printer.Print(ConsoleColor.Magenta);

            var appointmentRepository = new MyRepository <Appointment>();
            var appointment           = appointmentRepository.Fetch(@event.AppointmentId);
            var appointmentsOfJob     = new MyRepository <Appointment>().FetchAll().Where(a => a.JobId == appointment.JobId);

            if (appointmentsOfJob.All(a => a.IsCompleted()))
            {
                var jobRepository = new MyRepository <Job>();
                var job           = jobRepository.Fetch(appointment.JobId);

                job.Complete();
            }

            //Printer.Print("Job marked as in progress", ConsoleColor.Magenta);
        }
Exemplo n.º 2
0
 public void Handle(AppointmentCompleted @event)
 {
     Status   = Status.Completed;
     Comments = @event.Comments;
 }