Esempio n. 1
0
        public void Apply(AppointmentScheduled @event)
        {
            if (@event.From != null && @event.To != null)
            {
                TimeSlot = new TimeSlot(@event.From.Value, @event.To.Value);
            }

            Id            = @event.AppointmentId;
            JobId         = @event.JobId;
            StaffMemberId = @event.StaffMemberId;
            Status        = Status.Initiated;
        }
Esempio n. 2
0
        private Appointment(Guid id,
                            Guid jobId,
                            DateTime?from      = null,
                            DateTime?to        = null,
                            Guid?staffMemberId = null)
        {
            if (from == null && to == null && staffMemberId == null)
            {
                throw new Exception("You have to either select time frame or select staff member");
            }

            var @event = new AppointmentScheduled(id, jobId, staffMemberId, from, to);

            Apply(@event);
            DomainEvents.Publish(@event);
        }