exam questions

Exam 70-487 All Questions

View all questions & answers for the 70-487 exam

Exam 70-487 topic 1 question 38 discussion

Actual exam question from Microsoft's 70-487
Question #: 38
Topic #: 1
[All 70-487 Questions]

DRAG DROP -
You are developing an ASP.NET MVC Web API application.
The methods of the Web API must return details about the result of the operation.
You need to create methods to update and delete users.
You have the following code:

Which code segments should you include in Target 1 and Target 2 to complete the code? (To answer, drag the appropriate code segments to the correct targets in the answer area. Each code segment may be used once, more than once, or nor at all. You may need to drag the split bar between panes or scroll to view content.)
Select and Place:

Show Suggested Answer Hide Answer
Suggested Answer:

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
zimzimzimma
4 years, 7 months ago
NotFound is already used as the result code in the exception message in the put method. Using NotFound again in the delete method as confirmation for a SUCCESFUL delete is confusing since it's already used as an error statuscode in the put method. NoContent indicates a succesful delete here.
upvoted 2 times
...
MalaSvinjica
4 years, 11 months ago
Shouldn't target 5 be NotFound as well?
upvoted 2 times
GabF
4 years, 11 months ago
I think it’s “NoContent” because you have already removed and you would like one message to confirm. If you compare where it has “NotFoud”, before that there is a condition.
upvoted 7 times
...
mr_
4 years, 9 months ago
I don't think so. If you put NotFound there then even if the resource of particular ID has been found and successfully deleted you would return 404 Not found which would be wrong in that case.
upvoted 1 times
...
ammariii
4 years, 5 months ago
There is no enum called "HttpStatusCode.NoContent" at all for HTTpResponseMessage class , It's only HttpStatusCode.NotFound
upvoted 1 times
ammariii
4 years, 5 months ago
sorry , ignore this
upvoted 1 times
...
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago