Controllers are important in MVC web applications as they control incoming and outgoing requests. The document outlines a lesson presented by Naser Chowdhury on controllers, including defining what controllers are, their importance, how to create them, and how they are implemented in code. The lesson included a live coding demonstration and breakout group discussion on the topic. Major takeaways were the role of controllers and how to create and use them in MVC applications.
Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...
Week 2- Controllers in ASP .NET Core MVC Web Application.pptx
1. STUDENTS SUCCEED AT RTC
Controllers in MVC
By
Naser Chowdhury
Email: mchowdhury@rtc.edu
2. RENTON
TECHNICAL
COLLEGE
Agenda of the Lesson
• Why Controllers?
• The Importance of the Controllers in MVC Web Application
• Understanding of the Controllers Concept
• Live Coding session to demonstrate the concept
• Break-out rooms sessions for students discussion
• Major Takeaways
• References
3. RENTON
TECHNICAL
COLLEGE
Controllers
• Controllers are the C# classes which controls the incoming and outgoing requests
in an MVC (Model-View-Controller) web application.
• Controller sits in middle of the View and Model logically and controls the
authentication and authorization to access items from the Model of the application.
• To read from the model and to write into model, all the read/write requests should
go through the controllers.
4. RENTON
TECHNICAL
COLLEGE
The importance of controllers
• Controllers are the control center of an Web Application. What does it control? It
controls the incoming and outgoing HTTP requests.
• Web users post a form after filling it up into the server, but before saving it into the
server it should be checked.
• Unchecked forms could lead a serious threat to the application as it may come from
the hackers and intruders.
• Signing in to and accessing to a specific resources from the application should be
verified by controllers.
• Controllers are served as the middleware for the MVC web application.
5. RENTON
TECHNICAL
COLLEGE
Creating Controllers
• Controllers can be created very easily and it is a straightforward process.
• Go to Controllers Folder -> Right Click on the Folder -> Then Hover your mouse on
Add -> then Select Controller.
6. RENTON
TECHNICAL
COLLEGE
Controllers in Coding
• In the HomeController.cs, you will see some methods associated with views.
• Index() is associated with the Index view page that is created in the Views.
• Privacy() is associated with the Privacy view page that lies in the Privacy folder in
the Views.
Let’s see sample source code from the HomeController:
7. RENTON
TECHNICAL
COLLEGE
Break-out rooms session
• Please select a break-out room for your team and start discussing about today’s
topics.
• You should discuss about the importance of Controllers and why to create
controllers.
• Moreover, you need to check the Controllers Action Methods into the Views folder.
• You will have 25 mins to complete the session.
8. RENTON
TECHNICAL
COLLEGE
Major takeaways today!
• The importance of having controllers into our Web Application
• The roles of an controller in MVC web applications
• Ways to create controller
• In the coding, how to implement and write controllers action methods.
• Creating controllers when needed.
9. RENTON
TECHNICAL
COLLEGE
References
• The images are taken from Naser’s IDE (Integrated Development Environment).
• The drawing is done by Naser.
"Software Application Development I" by Naser Chowdhury, Renton Technical College is
licensed under CC BY 4.0