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); }
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); }
public ReviewsViewModel() { Reviews = new List <ReviewViewModel>(); Statistics = new ReviewStatisticsViewModel(); }