コード例 #1
0
        public List <ArticleLikeDisslikeDto> GetUsersLikedOrDisslikedArticle(long articleId, LikeDisslikeType _likeDisslikeType)
        {
            return(_context.ArticleLikeDisslikes
                   .AsNoTracking()
                   .Include(x => x.User)
                   .Where(x => x.ArticleId == articleId && x.LikeDisslikeType == _likeDisslikeType)
                   .Select(y => new ArticleLikeDisslikeDto()
            {
                Id = y.Id,

                User = new UserDto()
                {
                    Id = y.User.Id,
                    Name = y.User.Name,
                    Lastname = y.User.Lastname,
                    Picture = y.User.Picture
                }
            }).ToList());
        }
        public IDataResult <List <ArticleLikeDisslikeDto> > GetUsersLikedOrDisslikedArticle(long articleId, LikeDisslikeType likeDisslikeType)
        {
            var errorResult = BusinessRules.Run(IsArticleExist(articleId));

            if (errorResult != null)
            {
                return(ResultConverter.ResultToDataResult <List <ArticleLikeDisslikeDto> >(errorResult));
            }

            return(new SuccessDataResult <List <ArticleLikeDisslikeDto> >(_uow.ArticleLikeDisslikes.GetUsersLikedOrDisslikedArticle(articleId, likeDisslikeType)));
        }