Beispiel #1
0
 public async Task <PatientPage> GetPatients(FindPatientModel model, int limit, int skip)
 {
     try
     {
         List <Patient> collection;
         if (!String.IsNullOrWhiteSpace(model.PatientId))
         {
             collection = await _patients.Find(p => p.PatientId == model.PatientId)
                          .Skip(skip)
                          .Limit(limit)
                          .ToListAsync();
         }
         else
         {
             collection = await _patients.Find(p => p.Name == model.Name).ToListAsync();
         }
         var patientPage = new PatientPage
         {
             Patients = collection.ConvertToDTOExtension().ToList(),
             Count    = Convert.ToInt32(await _patients.CountAsync(new BsonDocument()))
         };
         return(patientPage);
     }
     catch (Exception e)
     {
         Debug.WriteLine(e.Message);
         return(null);
     }
 }
Beispiel #2
0
        public async Task <IHttpActionResult> GetPatients([FromBody] FindPatientModel model)
        {
            try
            {
                IEnumerable <PatientDTO> patients = await _manager.GetPatients(model);

                return(patients.Count() > 0 ? Json(patients) : (IHttpActionResult)BadRequest("no patients found!"));
            }
            catch (Exception ex) { return(InternalServerError(ex)); }
        }
Beispiel #3
0
        public async Task <IEnumerable <PatientDTO> > GetPatients(FindPatientModel model)
        {
            List <Patient> collection;

            if (!String.IsNullOrWhiteSpace(model.PatientId))
            {
                collection = await _patients.Find(p => p.PatientId == model.PatientId).ToListAsync();
            }
            else
            {
                collection = await _patients.Find(p => p.Name == model.Name).ToListAsync();
            }
            return(collection.ConvertToDTOExtension().ToList());
        }
Beispiel #4
0
 public Task <PatientPage> GetPatients(FindPatientModel model)
 {
     return(_pRep.GetPatients(model, 1, 0));
 }
Beispiel #5
0
 public Task <IEnumerable <PatientDTO> > GetPatients(FindPatientModel model)
 {
     return(_pRep.GetPatients(model));
 }