In this video, the instructor demonstrates how action selector attributes affect the action invocation process, by applying action name and HTTP verb attributes.
- [Instructor] Let's go deeper into…how action selector attributes work…by applying them to controller actions.…In the Artifacts folder of the exercise files…you'll find a couple of new files…that I've already added to the RouxAcademy project.…There's a ContactUs view in the Views Home folder.…This will be a simple page…that captures a user's email address…and comments they've entered about Roux Academy.…
The view is bound to the contact view model,…which I've added to the HomeViewModels folder…under Models.…Let's open the Home Controller…and scroll down to the end of the class.…Here, we'll add a new ContactUs action method…to display the view.…And it'll simply return a view result.…
We need another ContactUs action for the form post.…And we'll pass in the ContactViewModel…where we'll have to add in the HomeViewModel's namespace…and we'll call it contact.…Let's just add a TODO comment here…to forward contact info to the support team.…
And, finally, we'll return the View with the contact model.…Notice how we have two action methods with the same name…
Author
Released
5/1/2018- Fundamentals of the request life cycle
- Designing and implementing HTTP modules and handlers
- Choosing between handlers and modules
- Understanding route handlers
- Configuring convention-based routing
- ASP.NET MVC attribute routing
- Creating a custom controller factory
- Defining a custom dependency resolver
- Creating a custom view engine
Skill Level Intermediate
Duration
Views
Related Courses
-
Introduction
-
Welcome1m 4s
-
What you should know1m 31s
-
-
1. The Application and Request Life Cycle
-
2. Design and Implement HTTP Modules and Handlers
-
HTTP module overview3m 52s
-
-
3. The ASP.NET MVC Routing System
-
Introduction to routing2m 10s
-
URL routing module overview3m 43s
-
Understand route handlers1m 53s
-
Explore attribute routing4m 10s
-
-
4. Controllers and the Request Life Cycle
-
Controller basics1m 38s
-
-
5. The Action Method Execution Process
-
6. Result Execution and the View Engine
-
Explore action result types3m 24s
-
Conclusion
-
Next steps1m 11s
-
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.
CancelTake notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.
Share this video
Embed this video
Video: Work with action selector attributes