Beispiel #1
0
        public void Execute(AppointmentStarted @event)
        {
            Printer.Print(ConsoleColor.Magenta);

            var appointmentRepository = new MyRepository <Appointment>();
            var appointment           = appointmentRepository.Fetch(@event.AppointmentId);
            var jobRepository         = new MyRepository <Job>();
            var job = jobRepository.Fetch(appointment.JobId);

            job.Start();

            //Printer.Print("Job marked as in progress", ConsoleColor.Magenta);
        }
Beispiel #2
0
        public void Start()
        {
            Printer.Print(ConsoleColor.Cyan);

            if (Status == Status.Canceled)
            {
                throw new Exception("Appointment is cancelled, can not mark it in progress");
            }

            var @event = new AppointmentStarted(Id);

            Apply(@event);
            DomainEvents.Publish(@event);
        }
Beispiel #3
0
 public void Apply(AppointmentStarted @event)
 {
     Status = Status.InProgress;
 }