nerdexam
Microsoft

70-515 · Question #38

You are implementing an ASP.NET MVC 2 Web application. A controller contains the following code. public ActionResult Edit(int id) { return View(SelectUserToEdit(id)); } public ActionResult…

The correct answer is B. Add the following attribute to the first Edit action. C. Add the following attribute to the second Edit action. See the full explanation below for the reasoning.

Question

You are implementing an ASP.NET MVC 2 Web application. A controller contains the following code. public ActionResult Edit(int id) { return View(SelectUserToEdit(id)); } public ActionResult Edit(Person person) { UpdateUser(person); return RedirectToAction("Index"); } The first Edit action displays the user whose details are to be edited, and the second Edit action is called when the Save button on the editing form is clicked to update the user details. An exception is thrown at run time stating that the request for action Edit is ambiguous. You need to correct this error and ensure that the controller functions as expected. What are two possible ways to achieve this goal? (Each correct answer presents a complete solution. Choose two.)

Options

  • AAdd the following attribute to the first Edit action.
  • BAdd the following attribute to the first Edit action.
  • CAdd the following attribute to the second Edit action.
  • DAdd the following attribute to the second Edit action.

How the community answered

(24 responses)
  • A
    8% (2)
  • B
    75% (18)
  • D
    17% (4)

Community Discussion

No community discussion yet for this question.

Full 70-515 Practice