示例#1
0
        public PatientInfoForIndexListVM GetAllPatient()
        {
            var patients = _patientRepository.GetAll().ProjectTo <PatientInfoForIndexVM>(_mapper.ConfigurationProvider).ToList();

            foreach (var patient in patients)
            {
                var visit = _visitRepository.GetForPatient(patient.Id).Where(p => p.VisitDate.CompareTo(DateTime.Now) > 0).Select(p => p.VisitDate);//.DefaultIfEmpty(default).Min();//.Min();

                if (visit.Any())
                {
                    patient.NextVisit = visit.Min();
                }
            }
            return(new PatientInfoForIndexListVM()
            {
                Patients = patients
            });
        }