From the course: Learning ASP.NET
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Implement controllers and views
- [Instructor] Let's continue working with our sample application and delve deeper into MVC concepts. We'll add the ability to manage courses for Rue Academy. The first thing to think about, is the model that represents a course. Right-click on the model's folder and select add, class. I'll name it Course. It'll be a simple class with properties that correspond to the attributes of a course. I'll add the properties using a shortcut, so type prop and hit the tab key twice. This will be an int for the course id. Then a string property for the name. And another string property for the course description. Finally, I'll add a Boolean property to indicate if it's a virtual course. Now that our model's ready, let's add a new controller that'll be responsible for managing courses. Right-click on the controller's folder, choose add and then controller. I'll select MVC 5 Controller with read right actions and click add. And name it Course Controller. This will generate scaffolding code for some…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.