public async Task <IEnumerable <MeetingDto> > Handle(GetMeetingsQuery getMeetingsQuery, CancellationToken cancellationToken) { var meetings = await _meetingRepository.GetMeetingsAsync(); SearchByParams(ref meetings, getMeetingsQuery); var list = meetings.Select(x => _mapper.Map <MeetingDO, MeetingDto>(x)).ToList(); _authorizationService.FilterResultByUserRights(_httpContextAccessor.HttpContext, ref list); return(list); }
private void SearchByParams(ref IEnumerable <MeetingDO> meetings, GetMeetingsQuery getMeetingsQuery) { if (!String.IsNullOrEmpty(getMeetingsQuery.Title)) { meetings = meetings.Where(x => x.Title.ToLower().Contains(getMeetingsQuery.Title.ToLower())); } if (!String.IsNullOrEmpty(getMeetingsQuery.GroupID)) { meetings = meetings.Where(x => x.GroupID.Contains(getMeetingsQuery.GroupID.ToLower())); } }