/// <summary> /// Initializes an instance of the <see cref="AppointmentDetails"/> class /// </summary> public AppointmentDetails(User medicalPractitioner, AppointmentSlot appointmentSlot) { if (medicalPractitioner == null) { throw new ArgumentNullException(nameof(medicalPractitioner)); } if (appointmentSlot == null) { throw new ArgumentNullException(nameof(appointmentSlot)); } State = appointmentSlot.State; AppointmentDateTime = appointmentSlot.AppointmentDateTime; AppointmentDurationInMins = appointmentSlot.AppointmentDurationInMins; AppointmentSlotId = appointmentSlot.Id; if (appointmentSlot.PatientId != null) { PatientId = (int)appointmentSlot.PatientId; } PatientFirstname = appointmentSlot?.Patient?.Firstname; PatientLastname = appointmentSlot?.Patient?.Lastname; if (medicalPractitioner.JobDescription != null & medicalPractitioner.EmployeeDetails != null) { MedicalPractitionerDetails = new MedicalPractitionerDetails( medicalPractitioner.Id, medicalPractitioner.JobDescription.Description, medicalPractitioner.EmployeeDetails); } }
/// <summary> /// Initializes a new instance of the <see cref="AppointmentSessionDetails"/> class /// </summary> public AppointmentSessionDetails(AppointmentSession session, User medicalPractitioner) { if (session == null) { throw new ArgumentNullException(nameof(session)); } if (medicalPractitioner == null) { throw new ArgumentNullException(nameof(medicalPractitioner)); } Id = session.Id; MedicalPractitioner = new MedicalPractitionerDetails(medicalPractitioner.Id, medicalPractitioner.JobDescription.Description, medicalPractitioner.EmployeeDetails); StartDateTime = session.StartDateTime; EndDateTime = session.StartDateTime.AddMinutes(session.DurationInMins); AppointmentSlots = session.AppointmentSlots.ToList(); }