Exemplo n.º 1
0
        /// <summary>
        /// 获取并转换为<see cref="QuestionDetails"/>类型数据对象
        /// </summary>
        /// <returns></returns>
        public QuestionDetails ConvertToQuestionDetails()
        {
            if (Question == null)
            {
                return(null);
            }

            //科目名称
            var subjectName = SubjectsAccessor.GetName(Question.SubjectId);
            //课程标题
            var courseTitle = CourseAccessor.GetTitle(Question.CourseId);

            var details = new QuestionDetails
            {
                QuestionId  = Question.QuestionId,
                Answer      = QuestionTools.DeserializeAnswers(Question.Answer, Question.Type),
                Count       = Question.Count,
                CourseId    = Question.CourseId,
                CourseTitle = courseTitle,
                CreateTime  = Question.CreateTime,
                LastTime    = Question.LastTime,
                Marking     = Question.Marking,
                Status      = Question.Status,
                SubjectId   = Question.SubjectId,
                SubjectName = subjectName,
                Topic       = Question.Topic,
                Type        = Question.Type,
                UserId      = Question.UserId
            };

            return(details);
        }
Exemplo n.º 2
0
 /// <summary>
 /// 获取课程所在科目的名称
 /// </summary>
 /// <returns></returns>
 public string GetSubjectName()
 {
     return(SubjectsAccessor.GetName(Course.SubjectId));
 }