예제 #1
0
        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);
        }
예제 #2
0
 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()));
     }
 }