Exemplo n.º 1
0
        /// <summary>
        /// Gets the collection of PatientInfos that had appointments recently.
        /// </summary>
        /// <returns> The collection of PatientView objects.</returns>
        public IEnumerable <PatientView> GetRecentPatients()
        {
            // TODO: Implement search throw PatientAppoinment table when available
            var recentPatients = (from patient in _data.GetPatients()
                                  where patient.IsDeleted != true
                                  join entry in _data.GetAppointments() on patient.Id equals entry.PatientId
                                  orderby entry.AppointmentDateTime descending
                                  select patient).Distinct().Take(5);

            var result = _mapper.Map <IEnumerable <PatientInfo>, IEnumerable <PatientView> >(recentPatients);

            return(result);
        }