Exemple #1
0
        public Appointment AddAppointment(Appointment appointment)
        {
            try
            {
                if (!IsAppointmentDateAvailableForGivenDoctor(appointment.AppointmentDate, appointment.Doctor.UserId))
                {
                    throw new OccupiedAppointmentDateException(appointment.AppointmentDate, appointment.Doctor.UserId);
                }

                return(_appointmentDataAccess.AddAppointment(appointment).RemoveReferenceLoop());
            }
            catch (Exception e)
            {
                return(null);
            }
        }