コード例 #1
0
ファイル: UserQuizzesRepo.cs プロジェクト: kontur-edu/uLearn
		public async Task<UserQuiz> AddUserQuiz(string courseId, bool isRightAnswer, string itemId, string quizId, Guid slideId, string text, string userId, DateTime time, int quizBlockScore, int quizBlockMaxScore)
		{
			var quizzesRepo = new QuizzesRepo(db);
			var currentQuizVersion = quizzesRepo.GetLastQuizVersion(courseId, slideId);
			var userQuiz = new UserQuiz
			{
				CourseId = courseId,
				SlideId = slideId,
				QuizVersionId = currentQuizVersion.Id,
				IsRightAnswer = isRightAnswer,
				ItemId = itemId,
				QuizId = quizId,
				Text = text,
				Timestamp = time,
				UserId = userId,
				QuizBlockScore = quizBlockScore,
				QuizBlockMaxScore = quizBlockMaxScore
			};
			db.UserQuizzes.Add(userQuiz);
			await db.SaveChangesAsync();
			return userQuiz;
		}
コード例 #2
0
ファイル: UserQuizzesRepo.cs プロジェクト: epeshk/uLearn
        public async Task <UserQuiz> AddUserQuiz(string courseId, bool isRightAnswer, string itemId, string quizId, Guid slideId, string text, string userId, DateTime time, int quizBlockScore, int quizBlockMaxScore)
        {
            var quizzesRepo        = new QuizzesRepo(db);
            var currentQuizVersion = quizzesRepo.GetLastQuizVersion(courseId, slideId);
            var userQuiz           = new UserQuiz
            {
                CourseId          = courseId,
                SlideId           = slideId,
                QuizVersionId     = currentQuizVersion.Id,
                IsRightAnswer     = isRightAnswer,
                ItemId            = itemId,
                QuizId            = quizId,
                Text              = text,
                Timestamp         = time,
                UserId            = userId,
                QuizBlockScore    = quizBlockScore,
                QuizBlockMaxScore = quizBlockMaxScore
            };

            db.UserQuizzes.Add(userQuiz);
            await db.SaveChangesAsync();

            return(userQuiz);
        }