示例#1
0
        public ActionResult DeleteQuestion(QuizQuestionDTO token)
        {
            string error;

            _quizAdminServices.DeleteQuestion(token.QuestionId, out error);

            return(Json(ModelState.ToDataSourceResult()));
        }
示例#2
0
        public ActionResult SaveQuestion(QuizQuestionDTO token)
        {
            string error;
            var    isNew  = token.QuestionId < 0;
            var    result = _quizAdminServices.SaveQuestion(token, out error);

            return(Json(new JsonResponseToken {
                success = result, result = new { isNew, id = token.QuestionId }, error = error
            }, JsonRequestBehavior.AllowGet));
        }
示例#3
0
 public static void UpdateQuizQuestionEntity(this QZ_QuizQuestionsLib entity, QuizQuestionDTO token)
 {
     entity.QuestionText = token.QuestionText;
     entity.TypeId       = (byte)token.Type;
     entity.Description  = token.Description;
     entity.Score        = token.Score;
     entity.BcIdentifier = token.BcIdentifier;
     entity.ImageUrl     = token.ImageUrl;
     entity.IsActive     = token.IsActive;
     entity.UpdateDate   = DateTime.Now;
     entity.UpdatedBy    = DtoExtensions.CurrentUserId;
 }
示例#4
0
 public static QZ_StudentQuizAnswers QuestionDto2StudentQuizAnswerEntity(this QuizQuestionDTO token, Guid attemptId, int index)
 {
     return(new QZ_StudentQuizAnswers
     {
         AttemptId = attemptId
         , QuestionId = token.QuestionId
         , QuestionText = token.QuestionText
         , OrderIndex = index
         , Score = token.Score
         , IsCorrect = false
         , AddOn = DateTime.Now
     });
 }
示例#5
0
 public static QZ_QuizQuestionsLib Dto2QuizQuestionsEntity(this QuizQuestionDTO token)
 {
     return(new QZ_QuizQuestionsLib
     {
         QuizId = token.QuizId
         , QuestionText = token.QuestionText
         , TypeId = (byte)token.Type
         , Description = token.Description
         , Score = token.Score
         , OrderIndex = token.Index
         , BcIdentifier = token.BcIdentifier
         , ImageUrl = token.ImageUrl
         , IsActive = token.IsActive
         , AddOn = DateTime.Now
         , CreatedBy = DtoExtensions.CurrentUserId
     });
 }