コード例 #1
0
        public async Task <Answer> AddAnswerToQuestion(Answer answer)
        {
            try
            {
                var result = await _context.Answers.AddAsync(answer);

                await _context.SaveChangesAsync();

                return(answer);
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #2
0
        public async Task <Question> AddQuestionToQuiz(Question qstn)
        {
            try
            {
                var result = await _context.Questions.AddAsync(qstn);

                await _context.SaveChangesAsync();

                return(qstn);
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #3
0
        //create

        public async Task <Quiz> AddQuizAsync(Quiz quiz)
        {
            try
            {
                var result = await _context.Quizzes.AddAsync(quiz);

                await _context.SaveChangesAsync();

                return(quiz);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.InnerException.Message);
                return(null);
            }
        }
コード例 #4
0
        public async Task <Scores> AddScoreAsync(Scores score)
        {
            try
            {
                var reslust = await _context.Scores.AddAsync(score);

                await _context.SaveChangesAsync();

                return(score);
            }
            catch (Exception)
            {
                throw;
            }
        }