December 2019
Intermediate to advanced
598 pages
12h 21m
English
Let's move on to updating a question:
[HttpPut("{questionId}")]public ActionResult<QuestionGetSingleResponse> PutQuestion(int questionId, QuestionPutRequest questionPutRequest){ // TODO - get the question from the data repository // TODO - return HTTP status code 404 if the question isn't found // TODO - update the question model // TODO - call the data repository with the updated question model to update the question in the database // TODO - return the saved question}
We use the HttpPut attribute to tell ASP.NET Core that this method handles HTTP PUT requests. We are also putting the route parameter for the question ID in the questionId
Read now
Unlock full access