December 2019
Intermediate to advanced
598 pages
12h 21m
English
Let's implement the GetQuestion method now:
public QuestionGetSingleResponse GetQuestion(int questionId){ using (var connection = new SqlConnection(_connectionString)) { connection.Open(); var question = connection.QueryFirstOrDefault<QuestionGetSingleResponse>( @"EXEC dbo.Question_GetSingle @QuestionId = @QuestionId", new { QuestionId = questionId } ); // TODO - Get the answers for the question return question; }}
This method is a little different from the previous methods because we use the QueryFirstOrDefault Dapper method to return a single record (or null if the record isn't found) rather than ...
Read now
Unlock full access