Creating an Action Method for Getting a Single Question
Explore how to create an action method in ASP.NET Core for getting a single question. Understand using route parameters, returning JSON data, and handling 404 Not Found responses when the question does not exist.
We'll cover the following...
We'll cover the following...
Implementing action method for getting a single question
Let’s move on to implementing the action method for getting a single question. To do that, follow these steps:
Add the following skeleton method underneath the
GetUnansweredQuestionsmethod:
Note the HttpGet attribute parameter.
Note: The curly brackets tell ASP.NET to put the endpoint subpath in a variable that can be referenced as a method parameter. ...