Ejemplo n.º 1
0
        public QuizVersion AddQuizVersionIfNeeded(string courseId, QuizSlide slide)
        {
            var slideId = slide.Id;

            var quizXml         = slide.QuizNormalizedXml;
            var lastQuizVersion = GetLastQuizVersion(courseId, slideId);
            var newQuizVersion  = new QuizVersion
            {
                CourseId      = courseId,
                SlideId       = slideId,
                LoadingTime   = DateTime.Now,
                NormalizedXml = quizXml
            };

            if (lastQuizVersion == null || lastQuizVersion.NormalizedXml != newQuizVersion.NormalizedXml)
            {
                db.QuizVersions.Add(newQuizVersion);
                db.SaveChanges();

                return(newQuizVersion);
            }

            return(lastQuizVersion);
        }
Ejemplo n.º 2
0
 public void Delete(UserQuestion userSolution)
 {
     db.UserQuestions.Remove(userSolution);
     db.SaveChanges();
 }