예제 #1
0
        /// <summary>
        /// Get list of object from database.
        /// </summary>
        /// <returns>An enumerable collection of object having type as PatientEntity.</returns>
        public IEnumerable <PatientEntity> GetPatients()
        {
            IPatientDataAccess    dataAccess       = DALFactory.CreateInstance(CallingContext.ContextTypeA);
            IEnumerable <Patient> patientsDBEntity = dataAccess.GetPatients();
            List <PatientEntity>  patients         = new List <PatientEntity>();

            foreach (var item in patientsDBEntity)
            {
                PatientEntity patient = new PatientEntity
                {
                    Id            = item.Id,
                    Address       = item.Address,
                    BirthDate     = item.BirthDate,
                    ContactNumber = item.ContactNumber,
                    Gender        = item.Gender == 0 ? "Male" : "Female",
                    Name          = item.Name,
                    IsActive      = item.IsActive
                };
                patients.Add(patient);
            }
            return(patients);
        }
 public Patient[] GetPatients()
 {
     return(_patientDataAccess.GetPatients().Select(p => (Patient)p.NoPassword()).ToArray());
 }