public async Task <PatientResult> Register(string firstName, string species, string breed, Guid clientId) { bool clientExists = await _clientReadOnlyRepository.ExistsById(clientId); if (!clientExists) { throw new ClientNotFoundException($"The client {clientId} does not exists."); } Patient patient = new Patient(firstName, breed, species, clientId); await _patientWriteOnlyRepository.Add(patient); PatientResult patientResult = new PatientResult(patient); return(patientResult); }
public async Task <AppointmentResult> CreateAppointment(string appointmentType, DateTime requestDate, Guid clientId, Guid patientId) { bool clientExists = await _clientReadOnlyRepository.ExistsById(clientId); if (!clientExists) { throw new ClientNotFoundException($"The client {clientId} does not exists."); } bool patientExists = await _patientReadOnlyRepository.ExistsById(patientId); if (!patientExists) { throw new PatientNotFoundException($"The patient {patientId} does not exists."); } Appointment appointment = new Appointment(appointmentType, requestDate, clientId, patientId); AppointmentResult aptResult = new AppointmentResult(appointment); return(aptResult); }