示例#1
0
        public static void Shutdown()
        {
            try
            {
                ModelAssembler = null;
            }

            catch (Exception ex)
            {
                Log.Error(ex);
            }
        }
示例#2
0
        public static void Startup(string connectionString)
        {
            try
            {
                ModelAssembler = new ModelAssembler(connectionString);
            }

            catch (Exception ex)
            {
                Log.Error(ex);
            }
        }
示例#3
0
 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;
     }
 }
示例#4
0
 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;
     }
 }
示例#5
0
 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;
     }
 }
示例#6
0
 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;
     }
 }