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.
Create the delete API endpoint
From the course: Building Angular and ASP.NET Web API Apps
Create the delete API endpoint
- [Instructor] In this part, we are going to add a new action and this action is going to be used to delete a transaction from the database. This is basically the last feature of that section. We are going to create an action which is going to handle an HttpDelete request from the Angular app, and then it's going to remove the data from the database and then return or send a response back to the Angular app. For that, let us go to Visual Studio. In here, when we delete an app from the database, we don't need to pass any data from the request body. We just need the transaction id, which we can pass in the request URL. So for that, after the HttpPut, I'm going to use HttpDelete, and then to follow the same coding conventions, I'm going to use in here either Delete or Remove, and then pass as a parameter, id. Then, down here, the same as in the other actions, I'm going to use IActionResult DeleteTransaction, pass as a parameter the id. Let us first check if the transaction with this id…
Contents
-
-
-
-
Create an empty Web API Project9m 4s
-
(Locked)
Define application models5m 47s
-
(Locked)
Configure entity framework for database access13m 55s
-
(Locked)
Build the Create API endpoint10m 41s
-
(Locked)
Create the read-all API endpoint3m 4s
-
(Locked)
Create the read by ID API endpoint6m 55s
-
(Locked)
Create the update API endpoint7m 4s
-
(Locked)
Create the delete API endpoint3m 10s
-
(Locked)
Cleanup Code16m 24s
-
-
-
-
-