Creating controller action methods
Action methods are where we can write code to handle requests to a resource. In this section, we are going to implement action methods that will handle requests to the questions resource. We will cover the GET
, POST
, PUT
, and DELETE
 HTTP methods.
Creating an action method for getting questions
Let's implement our first action method, which is going to return an array of all the questions. Open QuestionsController.cs
and carry out the following steps:
- Let's create a method calledÂ
GetQuestions
 at the bottom of theQuestionsController
class:[HttpGet] public IEnumerable<QuestionGetManyResponse> GetQuestions() {     // TODO - get questions from data repository     // TODO - return questions in the response }
We decorate the method with theÂ
HttpGet
 attribute to tell ASP.NET that this will handle HTTPÂGET
 requests...