Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

C# ASP.NET MVC Basics Controllers Creating a Controller

I can't pass Task 1 on the VideoGamesController.cs. I have looked for answers but can't figure out what I'm doing wrong.

I've tried adding : Controller at the end of the class but that doesn't work either. My errors that return back to me are about the "}" , however, I believe they're in the right place. Not sure what's going on.

Error message: VideoGamesController.cs(16,0): error CS1525: Unexpected symbol }' VideoGamesController.cs(16,1): error CS1514: Unexpected symbol}', expecting .' or{' Compilation failed: 2 error(s), 0 warnings

VideoGamesController.cs
using System.Web.Mvc;

namespace Treehouse.Controllers
{
    public class VideoGamesController
}

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! Yes, you will need the : Controller to tell it to inherit from the Controller base class. But don't forget that each class needs its own open and closed curly braces (even if there's nothing inside them yet). It will continue to issue a compiler warning because it needs the curly braces to continue.

This is the line you're looking for:

public class VideoGamesController : Controller {}

Hope this helps! :sparkles:

It worked! Thank you so much! Now I know to include the curly braces even if there isn't any code in it yet.