Example #1
0
        public async Task <QuizModel> FindQuestion(int QuestionId)
        {
            QuizModel questionDescription = new QuizModel();

            using (var conn = new SqlConnection(_configuration.Value))
            {
                conn.Open();
                questionDescription = conn.QueryFirst <QuizModel>(
                    "SELECT * FROM dbo.Questions WHERE QuestionId = @QuestionId", new { QuestionId }, commandType: CommandType.Text);
                conn.Close();
            }
            return(questionDescription);
        }
Example #2
0
        public async Task <QuizModel> GetQuizDetails(int QuizId)
        {
            QuizModel _quizModel = new QuizModel();

            using (var conn = new SqlConnection(_configuration.Value))
            {
                conn.Open();
                _quizModel = conn.QueryFirst <QuizModel>("SELECT * FROM dbo.Quiz WHERE QuizId = @QuizId", new { QuizId }, commandType: CommandType.Text);
                conn.Close();
            }

            return(_quizModel);
        }