Пример #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);
        }
Пример #2
0
 public Upload Get(int id)
 {
     return(_uploadRepository.Get(id).Map <Upload>());
 }