Пример #1
0
        private IEnumerable <Student> GetAllStudent()
        {
            List <Student> list     = new List <Student>();
            var            students = _userService.GetAllUserInRole("user");

            foreach (var item in students)
            {
                Student student = new Student()
                {
                    Name     = item.Name,
                    SurrName = item.Surrname
                };
                var raitings = _ratingsService.GetAllRaitingsForUser(item.Id);
                if (raitings.Count() > 0)
                {
                    student.AverageRate = raitings.Average(x => x.Grade);
                }
                list.Add(student);
            }

            return(list);
        }