From the course: Building Angular and ASP.NET Core Applications
Unlock the full course today
Join today to access over 24,500 courses taught by industry experts.
Delete API endpoint
From the course: Building Angular and ASP.NET Core Applications
Delete API endpoint
- [Instructor] It is great that the user can now add new books, modify existing books, and see all the books. But what if the user wants to delete a book from its collection? Well, let's implement a delete API endpoint to do that. So, let's go to visual code. And here we need to go to the books controller and scroll down after the update book. And write, delete the book. This is going to be an http delete request. So for that we write in here http delete. And the name of the API endpoint is going to be delete book. And we are going to pass as the parameter of this URL the book ID. Now, let's write in here public ix result. Delete book. And then int ID. Then you write service dot delete book. We pass as a parameter the ID. And let us just return. Okay. Let's save the changes and go to the delete book method and implement the S3 code. For that go inside the services method, then book service dot cs and implement…
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.