示例#1
0
        public List <UserReadModel> Handle(GetDoctorsQuery query)
        {
            var users = _redisService.HashGetAll <UserReadModel>("user", CommandFlags.PreferMaster);

            users = users.Where(u => u.Role == "Doctor");
            if (!string.IsNullOrWhiteSpace(query.Term))
            {
                users = users.Where(u => u.FamilyName.ToLower().Contains(query.Term.ToLower()) ||
                                    u.GivenName.ToLower().Contains(query.Term.ToLower()));
            }
            return(users.ToList());
        }
示例#2
0
        public async Task <IEnumerable <DoctorDTO> > GetDoctors()
        {
            var doctorQuery = new GetDoctorsQuery();

            if (doctorQuery == null)
            {
                throw new ApplicationException($"Doutor não pode ser obtido.");
            }

            var result = await _mediator.Send(doctorQuery);

            return(_mapper.Map <IEnumerable <DoctorDTO> >(result));
        }
示例#3
0
 public async Task <List <Doctor> > Handle(GetDoctorsQuery request, CancellationToken cancellationToken)
 {
     return(await _doctorRepository.GetDoctorsAsync());
 }