Creating Controller Action Methods
Learn about the controller action methods.
We'll cover the following
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:
Get hands-on with 1400+ tech skills courses.