Ejemplo n.º 1
0
        /// <summary>
        /// Processes the single aggregate.
        /// </summary>
        /// <param name="dto">The dto to process.</param>
        /// <param name="entity">The entity.</param>
        /// <returns>A <see cref="System.Boolean"/></returns>
        protected override bool ProcessSingleAggregate(AppointmentDetailsDto dto, Visit entity)
        {
            if (dto.ClinicianKey != entity.Staff.Key)
            {
                var staff = _staffRepository.GetByKey(dto.ClinicianKey.Value);
                entity.ReassignAppointment(staff);
            }
            entity.RescheduleAppointment(new DateTimeRange(dto.AppointmentStartDateTime.Value, dto.AppointmentEndDateTime.Value));

            var location = _locationRepository.GetByKey(dto.Location.Key);

            if (location.Key != entity.ServiceLocation.Key)
            {
                entity.ChangeServiceLocation(location);
            }

            return(true);
        }