Ejemplo n.º 1
0
 public TruncatedPatient GetPatientById(int id)
 {
     using (ClinicContext context = ClinicContextProvider.GetContext())
     {
         return(truncatedPatientMapper.Map(context.Patients.Where(x => x.Id == id).FirstOrDefault()));
     }
 }
Ejemplo n.º 2
0
 public IEnumerable <TruncatedPatient> GetAllPatients()
 {
     using (ClinicContext context = ClinicContextProvider.GetContext())
     {
         return(context.Patients.ToList().Select(x => truncatedPatientMapper.Map(x)));
     }
 }
 public TruncatedTreatPlan GetTreatPlan(int id)
 {
     using (ClinicContext context = ClinicContextProvider.GetContext())
     {
         var y = context.TreatPlans.Where(x => x.Id == id).Select(x => new { x, x.Disease, x.Doctor, x.Medication, x.Patient }).SingleOrDefault();
         y.x.Disease = y.Disease; y.x.Doctor = y.Doctor; y.x.Medication = y.Medication; y.x.Patient = y.Patient;
         return(truncatedTreatPlanMapper.Map(y.x));
     }
 }
 public IEnumerable <TruncatedTreatPlan> GetPatientTreatPlans(int id)
 {
     using (ClinicContext context = ClinicContextProvider.GetContext())
     {
         var y = context.TreatPlans.Where(x => x.Patient_Id == id).Select(x => new { x, x.Disease, x.Doctor, x.Medication, x.Patient }).ToList();
         y.ForEach(x => { x.x.Disease = x.Disease; x.x.Doctor = x.Doctor; x.x.Medication = x.Medication; x.x.Patient = x.Patient; });
         var res = y.Select(t => truncatedTreatPlanMapper.Map(t.x));
         return(res);
     }
 }