From the course: Building Angular and ASP.NET Web API Apps

Unlock this course with a free trial

Join today to access over 24,400 courses taught by industry experts.

Build the Create API endpoint

Build the Create API endpoint

- [Instructor] In this part, we're going to create our first API endpoint. We're going to use this API endpoint to create or to add a new transaction in our database. For that, we need to create an API endpoint, which is going to expect from the Angular app and HttpPost request. For that, let us go to Visual Studio. To create all the new API endpoints, I'm going to create a new controller. So in this solution explorer, I'll just go to the controllers folder, right click in here, go to add, and then controller. By default, you're going to have the MVC controller, but you need to go here to the left and you need to create an API controller. Let us create that API controller empty because we want to add a code ourselves. So go to add then define a name. We are going to name this one. The transactions controller. When a controller is created, by default is just going to create a class and then it's going to inherit from the base class controller base. And then here at the top you're going…

Contents