From the course: Building and Securing Restful APIs in .NET
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Implement resource DELETE - .NET Tutorial
From the course: Building and Securing Restful APIs in .NET
Implement resource DELETE
- [Instructor] Sometimes, we not only want to create or update, we also want to delete items out of our system. So we go back over our controller here, we've got our delete operation. Kind of sad and empty there. Let's go ahead and take some of these attributes from here so we don't have to retype them. Come down to the delete, put those in. So the 404 is valid. We might try and delete something and not find it. We could get the No Content, probably not going to have a client error 'cause we're really just passing the delete identifier. We'll make this our async task via action result again for delete. And again, we'll do some copy paste here, we'll grab this, try catch here, and we'll do the first operation where we pull that up and we'll return a NotFound. There's the end of our try and do a catch, add that in, and we'll just grab the same error we've... We'll paste that down here. We're going to say problem deleting employee resource. So if we don't find them, we're going to return…
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)
Defining URI templates4m 34s
-
(Locked)
Implement resource collection GET6m 56s
-
(Locked)
Implement resource GET5m 2s
-
(Locked)
Implement resource POST7m 48s
-
(Locked)
Implement resource PUT6m 49s
-
(Locked)
Implement resource PATCH8m 10s
-
(Locked)
Implement resource DELETE4m 28s
-
(Locked)
Review additional resource operations7m 20s
-
(Locked)
-
-
-
-