コード例 #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);
     }
 }
コード例 #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)); }
        }
コード例 #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());
        }
コード例 #4
0
ファイル: PatientsManager.cs プロジェクト: mrpsc/MRP-SERVER
 public Task <PatientPage> GetPatients(FindPatientModel model)
 {
     return(_pRep.GetPatients(model, 1, 0));
 }
コード例 #5
0
 public Task <IEnumerable <PatientDTO> > GetPatients(FindPatientModel model)
 {
     return(_pRep.GetPatients(model));
 }