Esempio n. 1
0
        /// <summary>
        /// Gets the rating statistics for the identified product
        /// </summary>
        /// <param name="product">Reference identifying the product</param>
        /// <returns>Rating statistics for the product</returns>
        private RatingStatistics GetProductStatistics(EPiServer.Social.Common.Reference product)
        {
            var statisticsCriteria = new Criteria <RatingStatisticsFilter>()
            {
                Filter = new RatingStatisticsFilter()
                {
                    Targets = new[] { product }
                },
                PageInfo = new PageInfo()
                {
                    PageSize = 1
                }
            };

            return(this.statisticsService.Get(statisticsCriteria).Results.FirstOrDefault());
        }
Esempio n. 2
0
        /// <summary>
        /// Gets a collection of reviews for the identified product.
        /// </summary>
        /// <param name="product">Reference identifying the product</param>
        /// <returns>Collection of reviews for the product</returns>
        private IEnumerable <Composite <Comment, Review> > GetProductReviews(EPiServer.Social.Common.Reference product)
        {
            var commentCriteria = new CompositeCriteria <CommentFilter, Review>()
            {
                Filter = new CommentFilter
                {
                    Parent = product
                },
                PageInfo = new PageInfo
                {
                    PageSize = 20
                },
                OrderBy = new List <SortInfo>
                {
                    new SortInfo(CommentSortFields.Created, false)
                }
            };

            return(this.commentService.Get(commentCriteria).Results);
        }