Exemplo n.º 1
0
        public async Task <IPagedResultDto <ReviewItemDto> > GetReviewsOfForestPlotAsync(PagingRequestDto pagingRequestDto, int forestPlotId, int actorId)
        {
            var extraData = new ExtraDataReviewsDto
            {
                IsUserReview = await _unitOfWork.GetRepository <APActorReview>()
                               .GetAll()
                               .AnyAsync(x => x.FK_ReviewUserID == _bysSession.GetUserId() && x.FK_ICForestPlotID == forestPlotId)
            };

            return(await _unitOfWork.GetRepository <APActorReview>()
                   .GetAllIncluding(x => x.APActor, x => x.ADUser, x => x.ICForestPlot)
                   .IncludesForToForestPlot(x => x.ICForestPlot)
                   .Where(x => x.FK_ICForestPlotID == forestPlotId && x.APActorReviewIsHide == false && x.FK_APActorID == actorId)
                   .OrderByDescending(x => x.APActorReviewDate)
                   .GetPagedResultAsync(pagingRequestDto.Page, pagingRequestDto.PageSize, x => x.ToReviewItemDto(), extraData));
        }
Exemplo n.º 2
0
        public async Task <IPagedResultDto <ReviewItemDto> > GetReviewsOfContactAsync(PagingRequestDto pagingRequestDto, int contactId)
        {
            var extraData = new ExtraDataReviewsDto
            {
                ReviewCount = await _unitOfWork.GetRepository <ARContactReview>()
                              .GetAll()
                              .Where(x => x.FK_ARContactID == contactId)
                              .CountAsync(),
                IsUserReview = await _unitOfWork.GetRepository <ARContactReview>()
                               .GetAll()
                               .AnyAsync(x => x.FK_ReviewUserID == _bysSession.GetUserId() && x.FK_ARContactID == contactId)
            };

            return(await _unitOfWork.GetRepository <ARContactReview>()
                   .GetAllIncluding(x => x.ADUser, x => x.ARContact)
                   .Where(x => x.FK_ARContactID == contactId)
                   .Where(x => !x.ARContactReviewIsHide.GetValueOrDefault())
                   .OrderByDescending(x => x.ARContactReviewDate)
                   .GetPagedResultAsync(pagingRequestDto.Page, pagingRequestDto.PageSize, x => x.ToContactReviewDto(), extraData));
        }