Exemplo n.º 1
0
        public static ReviewStatisticsViewModel Adapt(RatingStatistics statistics)
        {
            var viewModel = new ReviewStatisticsViewModel();

            if (statistics != null)
            {
                viewModel.OverallRating = Convert.ToDouble(statistics.Sum) / Convert.ToDouble(statistics.TotalCount);
                viewModel.TotalRatings  = statistics.TotalCount;
            }

            return(viewModel);
        }
Exemplo n.º 2
0
        public static ReviewStatisticsViewModel Adapt(RatingStatistics statistics)
        {
            var viewModel = new ReviewStatisticsViewModel();

            if (statistics != null)
            {
                viewModel.OverallRating = Convert.ToDouble(statistics.Sum) / Convert.ToDouble(statistics.TotalCount);
                viewModel.TotalRatings  = statistics.TotalCount;
                viewModel.Code          = statistics.Target.Id.Replace("product://", "");
            }

            return(viewModel);
        }
Exemplo n.º 3
0
 public ReviewsViewModel()
 {
     Reviews    = new List <ReviewViewModel>();
     Statistics = new ReviewStatisticsViewModel();
 }