Creating an Action Method for Updating a Question
Learn to create an action method for updating a question.
We'll cover the following...
We'll cover the following...
Implementing action method for updating a question
Let’s move on to updating a question. To do that, implement the following steps:
1. Add the following skeleton for the action method:
We use the HttpPut attribute to tell ASP.NET that this method handles HTTP PUT requests. We are also putting the route parameter for the question ID in the questionId method parameter.
The ASP.NET model binding will populate the QuestionPutRequest class instance from the HTTP request body.
2. Let’s get the question from the data repository and return HTTP status code 404 if the ...