Create a New Controller in ASP.NET MVC

Create a New Controller in ASP.NET MVC
- In order to Create a New Controller in ASP.NET MVC, you have to right click on the Controllers folder in Solution Explorer.
- Now click on the Add and then click on Controllers as shown in below figure:
- It will open up a new window which will have different types of Controllers and are used for different purposes.
- Here, we have to select the second one as we want to perform read/ write actions.
- So, select MVC 5 Controller with read / write actions and then clock Add Button, as shown in below figure:
- When you click the Add Button, it will ask for the Controller name.
- I have assigned it a name StudentController, now click the Add button, as shown in below figure:
- Now when we click the Add button, then a scaffolding operation will start by visual studio and it will automatically create our new controller.
- This new Controller file will also open up in our work space and it will have some classes by default in it, as shown in below figure:
- We have successfully created our new Controller to read or write data.
- In our previous lecture, we have already created a new Model in ASP.NET MVC.
- So, now we are only left with the Views which we are gonna create in our next tutorial and will also bind them together.
- Here's a video demonstration of How to Create a new Controller in ASP.NET MVC, it will help for better understanding:
×
![]()





































































