From the course: Building Angular and ASP.NET Web API Apps
Unlock the full course today
Join today to access over 24,100 courses taught by industry experts.
Creating a Web API HttpPost endpoint
From the course: Building Angular and ASP.NET Web API Apps
Creating a Web API HttpPost endpoint
- [Instructor] To create a new entry, either an expense or an income, we are going to create an API endpoint which is going to handle these kind of requests. So, for example, when the user posts or sends some data to the back-end, our API endpoint is going to check for data and then save it in our database. So, let's get started. In your visual studio, go to the controllers folder and, within this folder, open the entries controller. Because this is the controller that you are using to handle all the API requests related to the entries. Just after the get entries method, create a new one. We said that we are going to use this endpoint to handle the post requests, so for that, we need to define in here HttpPost. Then next let us start creating this method. So I'm going to write in here public IHttpActionResult and then PostEntry. We are going to send the entry data as the part of the body of the request. So, for that, we need to define in here that the data will come from the body. So…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
(Locked)
Creating a Web API HttpPost endpoint3m 48s
-
(Locked)
Configuring an Angular reactive form3m 40s
-
(Locked)
Creating an Angular reactive form7m 48s
-
(Locked)
Validating an Angular reactive form5m 41s
-
(Locked)
Designing a header and footer3m 36s
-
(Locked)
Creating an HttpPost request in Angular3m 18s
-
(Locked)
-
-
-
-
-