Ejemplo n.º 1
0
        public Appointment AddAppointment(string id, string patientId, string diagnostic, bool isEmergency)
        {
            if (patientRepository.Contains(patientId) == false)
            {
                throw new RepositoryException("Specified patient does not exist");
            }

            Appointment appointment = new Appointment();

            appointment.ID          = id;
            appointment.PatientID   = patientId;
            appointment.Diagnostic  = diagnostic;
            appointment.IsEmergency = isEmergency;

            appointment.Validate();

            appointmentRepository.Add(appointment);
            patientRepository.AddAppointment(id, patientId);
            return(appointment);
        }