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 PUT - .NET Tutorial
From the course: Building and Securing Restful APIs in .NET
Implement resource PUT
- [Instructor] Now that we can create an employee, we also want to go back and be able to potentially update an employee, and we'll do that with a put operation. I'm going to take everything we used in our post, I'm going to copy it and I'm going to come down here to the put and I'm going to replace that signature, making sure that I go up here and change the operation name so I have a different one. You notice I didn't take the attribute on line 72. I kept that to say that this operation is an HTTP put operation with an ID. So in that signature, then, not only do I need the particular resource that represents it, but I also need the id. So that's, again, going to be part of the URI that's going to get passed in in that URL, and the body is going to contain the resource, that employee that we're going to update. We'll do the same thing we did before with the post, line 78. If the model state isn't valid, we're going to return a client error. So we're going to indicate that that's a…
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)
-
-
-
-