Exemplo n.º 1
0
 static void WriteAverageRating(RecordingDto recordingDto, RecordingDataSet.Recording recording)
 {
     recordingDto.averageRatingSpecified = true;
     if (recording.GetReviews().Length == 0)
     {
         recordingDto.averageRating = 0;
     }
     else
     {
         int totalRating = 0;
         foreach (RecordingDataSet.Review review in recording.GetReviews())
         {
             totalRating += review.Rating;
         }
         recordingDto.averageRating = totalRating/recording.GetReviews().Length;
     }
 }
Exemplo n.º 2
0
 static void WriteReviews(RecordingDto recordingDto, RecordingDataSet.Recording recording)
 {
     recordingDto.reviews = new ReviewDto[recording.GetReviews().Length];
     int index = 0;
     foreach (RecordingDataSet.Review review in recording.GetReviews())
     {
         recordingDto.reviews[index++] = WriteReview(review);
     }
 }