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()); }
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)); }
public async Task <List <Doctor> > Handle(GetDoctorsQuery request, CancellationToken cancellationToken) { return(await _doctorRepository.GetDoctorsAsync()); }