public List <PathoSectionModelResult> GetPathoSections() { List <PathoSectionModelResult> PathoSectionList = new List <PathoSectionModelResult>(); using (EHMSEntities ent = new EHMSEntities()) { var data = (from x in ent.SetupSections select new { x.SectionId, x.Name }).ToList(); foreach (var item in data) { PathoSectionModelResult model = new PathoSectionModelResult(); model.Name = item.Name; model.SectionId = item.SectionId; PathoSectionList.Add(model); } return(PathoSectionList); } }
public List <PathoSectionModelResult> GetPathoSectionsbyPatientTest(int PatientTestID) { List <PathoSectionModelResult> PathoSectionList = new List <PathoSectionModelResult>(); using (EHMSEntities ent = new EHMSEntities()) { var data = (from x in ent.SetupSections join y in ent.PatientTestDetails on x.SectionId equals y.SectionID where y.PatientTestID == PatientTestID select new { x.SectionId, x.Name }).ToList().Distinct(); foreach (var item in data) { PathoSectionModelResult model = new PathoSectionModelResult(); model.Name = item.Name; model.SectionId = item.SectionId; PathoSectionList.Add(model); } return(PathoSectionList); } }