public static void Shutdown() { try { ModelAssembler = null; } catch (Exception ex) { Log.Error(ex); } }
public static void Startup(string connectionString) { try { ModelAssembler = new ModelAssembler(connectionString); } catch (Exception ex) { Log.Error(ex); } }
public List<Patient> GetPatient() { try { List<Patient> patientResult = null; using (var context = new HospitalContext()) { List<PatientContext> patientContexts = context.PatientContexts.ToList(); patientResult = ModelAssembler.CreatePatients(patientContexts); } return patientResult; } catch (Exception) { throw; } }
public Patient GetPatient(int id) { try { Patient patientResult = null; using (var context = new HospitalContext()) { PatientContext patientContext = context.PatientContexts.Find(id); patientResult = ModelAssembler.CreatePatient(patientContext); } return patientResult; } catch (Exception) { throw; } }
public List <Doctor> GetDoctors() { try { List <Doctor> doctorResult = null; using (var context = new HospitalContext()) { List <DoctorContext> doctorContexts = context.DoctorContexts.ToList(); doctorResult = ModelAssembler.CreateDoctors(doctorContexts); } return(doctorResult); } catch (Exception) { throw; } }
public Doctor GetDoctor(int id) { try { Doctor doctorResult = null; using (var context = new HospitalContext()) { DoctorContext doctorContext = context.DoctorContexts.Find(id); doctorResult = ModelAssembler.CreateDoctor(doctorContext); } return(doctorResult); } catch (Exception) { throw; } }