Which code segments should you include in Target 1, Target 2, Target 3 and Target 4 to complete the code?

DRAG DROP
You are developing a RESTful application by using ASP.NET MVC. The application is a pet
management system and implements the following method in a controller for retrieving pet
data.

The method must only accept JSON data using the standard MIME type.
You need to implement a controller that saves pet data and return a properly formatted
HTTP/1.1 protocol response.
You have the following code:

Which code segments should you include in Target 1, Target 2, Target 3 and Target 4 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 not at all.
You may need to drag the split bar between panes or scroll to view content.)

DRAG DROP
You are developing a RESTful application by using ASP.NET MVC. The application is a pet
management system and implements the following method in a controller for retrieving pet
data.

The method must only accept JSON data using the standard MIME type.
You need to implement a controller that saves pet data and return a properly formatted
HTTP/1.1 protocol response.
You have the following code:

Which code segments should you include in Target 1, Target 2, Target 3 and Target 4 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 not at all.
You may need to drag the split bar between panes or scroll to view content.)

Answer:



Leave a Reply 7

Your email address will not be published. Required fields are marked *


asd

asd

ActionResult
“application/json”
HttpResponseMessage
“/api/pet/”+pet.Id

M

M

Why ActionResult?
The question mentions “return a properly formatted HTTP/1.1 protocol response”
So the answer is correct.

FigArt

FigArt

Agree with M – the return type should be HttpResponseMessage. I think the question is missing “WebApi” in it – ActionResult is a red herring

nex-54

nex-54

It is said “by using ASP.NET MVC”
So, i don’t think HttpResposeMessage is correct. Also HttpResposeMessage is not generic type to use it like “HttpResposeMessage “

A

A

The answer is right.

Return response is equal with return HttpResponseMessage.

Peter Vogel

Peter Vogel

Since there is no generic version of HttpResponseMessage (HttpResponseMessage) — it only existed in a beta version of the Web API — it’s hard to imagine that it’s part of the right answer. Since the question specifically asks for ASP.NET MVC the return type should be Action Result.

stenly

stenly

+1
makes sense