예제 #1
0
파일: VoteService.cs 프로젝트: Yogso92/R8It
        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>());
 }