Writing data using Dapper
In this section, we are going to implement methods in our data repository that will write to the database. We will start by extending the interface for the repository and then do the actual implementation.
The stored procedures that perform the write operations are already in the database. We will be interacting with these stored procedures using Dapper.
Adding methods to write data to the repository interface
We'll start by adding the necessary methods to the repository interface:
public interface IDataRepository { ... QuestionGetSingleResponse PostQuestion(QuestionPostRequest question); QuestionGetSingleResponse PutQuestion(int questionId, QuestionPutRequest question); void DeleteQuestion(int questionId); AnswerGetResponse PostAnswer(AnswerPostRequest answer); }
Here...