Exemple #1
0
 public async Task CreateQuizAsync(QuizViewModel quiz)
 {
     if (quiz == null)
     {
         throw new ArgumentNullException(nameof(quiz));
     }
     var quizEntity = new QuizEntity(Quizzes, quiz.ID)
     {
         Json = JsonSerializer.Serialize(quiz)
     };
     var upsertOperation = TableOperation.Insert(quizEntity);
     await _quizzesTable.ExecuteAsync(upsertOperation);
 }
Exemple #2
0
        public void UpsertQuiz(QuizViewModel quiz)
        {
            if (quiz == null)
            {
                throw new ArgumentNullException(nameof(quiz));
            }
            var quizEntity = new QuizEntity(Quizzes, quiz.ID)
            {
                Json = JsonSerializer.Serialize(quiz)
            };
            var upsertOperation = TableOperation.InsertOrReplace(quizEntity);

            _quizzesTable.Execute(upsertOperation);
        }