示例#1
0
        /// <summary>
        /// 获取学员集合
        /// </summary>
        /// <returns></returns>
        private List <Student> GetStudents()
        {
            ThrowExceptionIfValidateFailure();

            var tempStudents = new List <Student>();

            //获取学员学习计划集合
            var studentPlans = UserStudyPlanAccessor.GetStudentStudyPlans(ID);

            //学员ID集合
            var studentIds = studentPlans.Select(p => p.UserId).ToArray();

            //根据学员ID集合获取学员信息
            var students = UsersAccessor.GetUserList(studentIds);

            foreach (var user in students)
            {
                var plan = studentPlans.FirstOrDefault(p => p.UserId == user.UserId);

                tempStudents.Add(new Student
                {
                    UserId        = user.UserId,
                    Email         = user.Email,
                    Mobile        = user.Mobile,
                    Title         = user.Title,
                    Name          = user.Name,
                    Username      = user.Username,
                    StudyStatus   = plan.Status,
                    Progress      = plan.Progress,
                    LastStudyTime = plan.UpdateTime
                });
            }

            return(tempStudents);
        }