Ejemplo n.º 1
0
        public IHttpActionResult GetById(int id)
        {
            try
            {
                var patient          = _patientManager.GetById <Patient>(id);
                var address          = _addressManager.GetWithWhereCondition <Address>($"Patientid = {id}").FirstOrDefault();
                var emergencyContact = _emergencyContactManager.GetWithWhereCondition <EmergencyContact>($"Patientid = {id}").FirstOrDefault();
                var consultations    = _consultationManager.GetWithWhereCondition <Consultation>($"PatientId = {id}");
                var appointments     = _appointmentManager.GetWithWhereCondition <Appointment>($"PatientId = {id}");
                var patientDTO       = _patientFactory.CreatePatientDTO(patient, address, emergencyContact, consultations, appointments);

                return(Content(HttpStatusCode.OK, patientDTO));
            }
            catch (Exception ex)
            {
                return(Content(HttpStatusCode.InternalServerError, ex.Message));
            }
        }
Ejemplo n.º 2
0
 public Patient GetPatientById(Appointment appointment)
 {
     return(patientManager.GetById <Patient>(appointment.PatientId));
 }