public async Task <PagedResultDto <NotificationDto> > GetListAsync(NotificationSearchDto pageDto) { List <NotificationDto> notification = (await _notificationRepository.Select .Include(r => r.ArticleEntry) .Include(r => r.CommentEntry) .Include(r => r.UserInfo) .WhereIf(pageDto.NotificationSearchType == NotificationSearchType.UserComment, r => r.NotificationType == NotificationType.UserCommentOnArticle || r.NotificationType == NotificationType.UserCommentOnComment) .WhereIf(pageDto.NotificationSearchType == NotificationSearchType.UserLike, r => r.NotificationType == NotificationType.UserLikeArticle || r.NotificationType == NotificationType.UserLikeArticleComment) .WhereIf(pageDto.NotificationSearchType == NotificationSearchType.UserLikeUser, r => r.NotificationType == NotificationType.UserLikeUser) .Where(r => r.NotificationRespUserId == _currentUser.Id) .OrderByDescending(r => r.CreateTime) .ToPagerListAsync(pageDto, out long totalCount)) .Select(r => { NotificationDto notificationDto = _mapper.Map <NotificationDto>(r); if (notificationDto.UserInfo != null) { notificationDto.UserInfo.Avatar = _fileRepository.GetFileUrl(notificationDto.UserInfo.Avatar); } return(notificationDto); }).ToList(); return(new PagedResultDto <NotificationDto>(notification, totalCount)); }
public async Task <PagedResultDto <NotificationDto> > GetListAsync([FromQuery] NotificationSearchDto pageDto) { return(await _notificationService.GetListAsync(pageDto)); }
public PagedResultDto <NotificationDto> Get([FromQuery] NotificationSearchDto pageDto) { return(_notificationService.Get(pageDto)); }