Beispiel #1
0
        public IEnumerable <DiagnosisDTO> GetBydia_patient(string dia_patient)
        {
            using (MyContext ctx = new MyContext())
            {
                var diags = ctx.Diagnosises.AsNoTracking().Where(e => e.dia_patient == dia_patient);
                List <DiagnosisDTO> list = new List <DiagnosisDTO>();
                foreach (var s in diags)
                {
                    DiagnosisDTO dia = new DiagnosisDTO();
                    // dia.doc_ID = s.doc_ID;
                    // dia.dia_patient = s.dia_patient;
                    dia.date     = s.date.ToString();
                    dia.med_Num  = s.med_Num;
                    dia.med_ID   = s.med_ID;
                    dia.result   = s.result;
                    dia.visit_ID = s.visit_ID;
                    //dia6.doc_ID = s.doc_ID;

                    PatientService pa1  = new PatientService();
                    var            dia1 = pa1.GetByID(dia_patient);

                    foreach (var s1 in dia1)
                    {
                        dia.patient_name = s1.patient_name;
                    }

                    DoctorService pa12 = new DoctorService();
                    var           dia2 = pa12.GetByID(s.doc_ID);

                    foreach (var s2 in dia2)
                    {
                        dia.doctor_name = s2.doctor_name;
                    }

                    list.Add(dia);
                }

                return(list);
            }
        }