Unlimited WordPress themes, graphics, videos & courses! Unlimited asset downloads! From $16.50/m
by
Lessons:20Length:2.3 hours
Asp designers1
  • Overview
  • Transcript

2.4 Controllers

Hello and welcome back to ASP.net, MVC for Designers. We've already talked about views and modules and in this lesson I wanna give you an overview of controllers within the MVC framework. So in an MVC project, we can find a controller's folder. And a controller as we've mentioned before, acts as kind of a go between the model and the view. The controller will handle any user input that might happen. The controller might also handle any calculations that need to be made before certain pieces of data are displayed in a view. So, in our web application here we can find in our controllers folder, a number of different controllers. So we have the home controller, for example. And if we look at the code here, we can see that a controller is made up of actions. For example, we have an index action, an about action, and a contact action. Now you might think to yourself that those action names kind of sound like a typical page name for a website. You might have an index page, or an about page, or a contact page on your web site. And that's exactly what these three items represent. They represent different pages. And you'll notice that each of these actions returns a view. And because of the magical way that MVC is set up in the ASP.NET framework, when we have a view being returned from an action called index, it's going to return the index view. You'll notice that we are in the home controller, so if we go to the view's folder to the home folder, we have a view or a CSS HTML file called Index. We also have one called About right here. And another one called Contact. Now if you're a programmer, you might end up with more actions or methods inside your controllers than just simple actions that represent a view. However again, we're focusing on designers here and we're gonna keep things pretty simple. So for now I want you to think of actions as representing a view. This particular action is responsible for displaying the Index view in the Home folder. As you can imagine, it can get a lot more complicated than that. But at a very simple level, that's what we're gonna be focusing on. So in the last three lessons, I've given you an overview of what models, views, and controllers look like within the ASP.NET framework. And now, as we move forward, we'll take a closer look at the Visual Studio environment. And we'll talk about how to create our on MVC projects and how to code our HTML and CSS within those projects. So thank you for watching, and I'll see you in the next lesson.

Back to the top