Exemple #1
0
        public override async Task <PaginatedList <GetArticleModel> > Handle(GetArticlesByIdsQuery request, CancellationToken cancellationToken)
        {
            IQueryable <Article> articlesByIds = await GetArticlesByIds(request.Ids);

            articlesByIds = _deletedEntityValidator.ValidateEntityQuerable(articlesByIds, Domain.Common.DeletedEntityPolicy.OWNER);

            var paginatedArticles = await articlesByIds.PaginatedListAsync(request.PagingParams);

            return(paginatedArticles.ToMappedPagedList <Article, GetArticleModel>(Mapper));
        }
        public override async Task <PaginatedList <GetCommentModel> > Handle(GetCommentsWithPaginationQuery request, CancellationToken cancellationToken)
        {
            var comments = await UnitOfWork.Comments.GetEntitiesAsync();

            comments = _deletedCommentValidator.ValidateEntityQuerable(comments, Domain.Common.DeletedEntityPolicy.OWNER);

            var paginatedComments = await comments.PaginatedListAsync(request.PagingParams);

            return(paginatedComments.ToMappedPagedList <Comment, GetCommentModel>(Mapper));
        }
Exemple #3
0
        public override async Task <PaginatedList <GetPublicUserModel> > Handle(GetPublicUsersWithPaginationQuery request, CancellationToken cancellationToken)
        {
            var users = await UnitOfWork.Users.GetEntitiesAsync();

            users = _deletedEntityValidator.ValidateEntityQuerable(users, Domain.Common.DeletedEntityPolicy.OWNER);

            var paginatedUsers = await users.PaginatedListAsync(request.PagingParams);

            return(paginatedUsers.ToMappedPagedList <User, GetPublicUserModel>(Mapper));
        }
        public override async Task <PaginatedList <GetArticleModel> > Handle(GetArticlesWithPaginationQuery request, CancellationToken cancellationToken)
        {
            var articles = await UnitOfWork.Articles.GetEntitiesAsync();

            articles = _deletedEntityValidator.ValidateEntityQuerable(articles, Domain.Common.DeletedEntityPolicy.OWNER);

            var paginatedArticles = await articles.PaginatedListAsync(request.PagingParams);

            return(paginatedArticles.ToMappedPagedList <Article, GetArticleModel>(Mapper));
        }
        public override async Task <PaginatedList <GetBoardModel> > Handle(GetBoardsWithPaginationQuery request, CancellationToken cancellationToken)
        {
            var boards = await UnitOfWork.Boards.GetEntitiesAsync();

            boards = _deletedBoardValidator.ValidateEntityQuerable(boards, Domain.Common.DeletedEntityPolicy.OWNER);

            var paginatedBoards = await boards.PaginatedListAsync(request.PagingParams);

            return(paginatedBoards.ToMappedPagedList <Board, GetBoardModel>(Mapper));
        }
Exemple #6
0
        public override async Task <PaginatedList <GetPublicUserModel> > Handle(GetUsersBySearchQuery request, CancellationToken cancellationToken)
        {
            var users = await UnitOfWork.Users.GetEntitiesAsync();

            var searchedUsers = users.Where(
                u => u.UserName.Contains(request.SearchTerm)
                );

            searchedUsers = _deletedUserValidator.ValidateEntityQuerable(searchedUsers, Domain.Common.DeletedEntityPolicy.OWNER);

            var paginatedSearchedUsers = await PaginatedList <User> .CreateAsync(searchedUsers,
                                                                                 request.PagingParams.PageNumber, request.PagingParams.PageSize);

            return(paginatedSearchedUsers.ToMappedPagedList <User, GetPublicUserModel>(Mapper));
        }
Exemple #7
0
        public override async Task <PaginatedList <GetCommentModel> > Handle(GetCommentsBySearchQuery request, CancellationToken cancellationToken)
        {
            var comments = await UnitOfWork.Comments.GetEntitiesAsync();

            var searchedComments = comments.Where(c =>
                                                  c.Text.Contains(request.SearchTerm)
                                                  );

            searchedComments = _deletedCommentValidator.ValidateEntityQuerable(searchedComments, Domain.Common.DeletedEntityPolicy.OWNER);

            var paginatedSearchedComments = await PaginatedList <Comment> .CreateAsync(searchedComments,
                                                                                       request.PagingParams.PageNumber, request.PagingParams.PageSize);

            return(paginatedSearchedComments.ToMappedPagedList <Comment, GetCommentModel>(Mapper));
        }
        public override async Task <PaginatedList <GetBoardModel> > Handle(GetBoardsBySearchQuery request, CancellationToken cancellationToken)
        {
            var boards = await UnitOfWork.Boards.GetEntitiesAsync();

            var searchedBoards = boards.Where(b =>
                                              b.Title.Contains(request.SearchTerm) ||
                                              b.Title.Contains(request.SearchTerm) ||
                                              b.Description.Contains(request.SearchTerm)
                                              );

            searchedBoards = _deletedBoardValidator.ValidateEntityQuerable(searchedBoards, Domain.Common.DeletedEntityPolicy.OWNER);

            var paginatedSearchedBoards = await PaginatedList <Board> .CreateAsync(searchedBoards,
                                                                                   request.PagingParams.PageNumber, request.PagingParams.PageSize);

            return(paginatedSearchedBoards.ToMappedPagedList <Board, GetBoardModel>(Mapper));
        }