Example #1
0
        public double GetResult(int uploadId) //returns average score in percent
        {
            IEnumerable <Vote> votes = GetVotes(uploadId);
            double             max   = RateChoiceRepository.GetChoices(_uploadRepository.Get(uploadId).RatingTypeId).Max(item => item.Value);

            if (votes.Count() > 0)
            {
                return(votes.Average(v => v.Rating.Value) / max * 100);
            }
            return(0);
        }
Example #2
0
 public List <RateChoice> GetRateChoices(int ratingtypeid)
 {
     return(ChoiceRepository.GetChoices(ratingtypeid).Select(c => c.Map <RateChoice>()).ToList());
 }