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 trial

C# ASP.NET MVC Basics Controllers Using Action Result Types

Tony Nilsson
Tony Nilsson
717 Points

VideoGamesController

Hi, I would like some help with this challenge. I do not understand what the task is about.

VideoGamesController.cs
using System.Web.Mvc;

namespace Treehouse.Controllers
{
    public class VideoGamesController : Controller
    {
        public ActionResult Detail()
        {
            return new ActionResult()
            {
                Content =  "Welcome to the Video Game Detail page!";
            };

        }
    }
}

2 Answers

HIDAYATULLAH ARGHANDABI
HIDAYATULLAH ARGHANDABI
21,058 Points
using System.Web.Mvc;

namespace Treehouse.Controllers
{
public class VideoGamesController : Controller
    {}

}
Steven Parker
Steven Parker
229,732 Points

You're off to a good start, you've changed the return type correctly.

But you don't need to construct an object, just call the "Content" method, which has been inherited from Controller (and pass the string as the argument).