public QuestionGetSingleResponse PutQuestion(int questionId, QuestionPutRequest question) { using (var connection = new SqlConnection(_connectionString)) { connection.Open(); connection.Execute(@"EXEC dbo.Question_Put @QuestionId = @QuestionId, @Title = @Title, @Content = @Content", new { QuestionId = questionId, question.Title, question.Content }); return(GetQuestion(questionId)); } }
public async Task <QuestionGetSingleResponse> PutQuestion(int questionId, QuestionPutRequest question) { await using var connection = new SqlConnection(_connectionString); await connection.OpenAsync(); await connection.ExecuteAsync( @"EXEC dbo.Question_Put @QuestionId = @QuestionId, @Title = @Title, @Content = @Content", new { QuestionId = questionId, question.Title, question.Content } ); return(await GetQuestion(questionId)); }