Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialKhoa Nguyen
4,735 PointsUpdate the provided VideoGamesController.Detail action method to use ActionResult for its return type instead ...
Update the provided VideoGamesController.Detail action method to use ActionResult for its return type instead of a string.
In the action method, return the result of a call to the base controller's Content method. Keep the content the same by passing the string literal "Welcome to the Video Game Detail page!" to the Content method. Bummer! In the 'Detail' method, are you returning a call to the 'Content' method? Restart Preview Get Help Recheck work VideoGamesController.cs
using System.Web.Mvc;
namespace Treehouse.Controllers
{
public class VideoGamesController : Controller
{
public ActionResult Detail()
{
return new ContentResult()
{
Content = "Hello from comic books controller"
};
}
}
}
1 Answer
Steven Parker
231,269 PointsThis task has two instructions. The first one is: "return the result of a call to the base controller's Content method.", but instead of calling that method, this code is instantiating a new ContentResult object and returning it.
Then the second instruction says: "Keep the content the same by passing the string literal "Welcome to the Video Game Detail page!" to the Content method". But this code contains the string literal "Hello from comic books controller" instead.