public void Dispose()
 {
     try
     {
         using (var context = new ApteanClinicContext())
         {
             context.Dispose();
         }
     }catch (Exception e)
     {
         ExceptionHandler.PrintException(e, new StackTrace(true));
         throw e;
     }
 }
 public List <MedicalHistory> GetMedicalHistories(int?id)
 {
     try
     {
         using (var context = new ApteanClinicContext())
         {
             return(context.MedicalHistories.Where(a => a.PatientId == (int)id).ToList());
         }
     }catch (Exception e)
     {
         ExceptionHandler.PrintException(e, new StackTrace(true));
         throw e;
     }
 }
 public List <MedicalHistory> GetAllMedicalHistory()
 {
     try
     {
         using (var context = new ApteanClinicContext())
         {
             return(context.MedicalHistories.ToList());
         }
     }catch (Exception e)
     {
         ExceptionHandler.PrintException(e, new StackTrace(true));
         throw e;
     }
 }
 public MedicalHistory AddMedicalHistory(MedicalHistory medicalHistory)
 {
     try
     {
         using (var context = new ApteanClinicContext())
         {
             context.MedicalHistories.Add(medicalHistory);
             context.SaveChanges();
             return(medicalHistory);
         }
     }catch (Exception e)
     {
         ExceptionHandler.PrintException(e, new StackTrace(true));
         throw e;
     }
 }