MVC Tutorials About Controllers MVC Tutorials About Controllers MVC Tutorials About Controllers. Controllers are the center point of all the data flow in the application. It takes the input HTTP request and rendering the exact output. So controllers are controlling all the flow. Whenever a new request comes from the browser then the controller takes the request and processes
which Model will be taken, and then it takes the data from the model to the respective view.

Points To Remember

  • Controllers are the Classes derived from System.Web.MVC.Controller.
  • Controllers contain public methods. These methods are called Action Methods.
  • The class name must end with Controller like  TestController
  • All Controller Classes are available in the Controller Folder Structure.

Steps To Create Controller 

Step 1:
               Open the Visual Studio and click on File Tab --> New -->Project menu

 MVC Controllers

 Step 2:
               Select Web from left pan next select web application and give the proper Name,     Location, and Solution at below pan finally click OK button. then you get one more Popup box where you choose the MVC option. Click the OK button. creates a template for a project.
         MVC Controllers Tutorials

Step 3:

           You can find the Controller folder has some Controller Classes with .cs extensions on the right side. every controller ends with Controller. You can observe from the Controller folder has three classes. These classes are AccountController.cs, HomeController, and ManageCotroller MVC Controllers Tutorials

If you open any one controller then you find the controller inherited from Controller. and each controller has Action Methods. From the below image, you can observe. MVC Controllers Tutorials

أحدث أقدم