Join Jess Chadwick for an in-depth discussion in this video Using a page model to keep logic out of the view, part of ASP.NET Core: Razor Pages.
- [Instructor] Up until now, I've put all…of the logic for my Razor Pages directly inside the page.…However, keeping in mind everything I just described…about loose coupling, this may not be the best approach…when it comes to maintainability of my applications.…Luckily, Razor Pages provides you with a great way…to get logic out of the view…and into its own separate class.…This class is called a page model, and it contains…all of the logic for your page, independent…of the markup that's going to consume that logic.…
So, let's see how to use the page model approach…in our application.…The next page I'm going to add to the application…will be one that will allow me…to add new recipes and edit existing ones.…And when I'm done, it'll contain a pretty significant amount…of logic, logic that I'd like…to keep separate from my markup.…So, that makes it a perfect candidate…for the page model approach.…I'm going to separate this new page from the other pages…in the site by putting it its own folder named Admin,…under the Pages folder.…
- Creating a new application
- Setting up pages
- Rendering dynamic content
- Reusing markup with layouts
- Increasing the maintainability of pages
- Processing data
- Validating input
- Securing an application
Skill Level Intermediate
Deploying ASP.NET Core Applicationswith Nate Barbettini57m 57s Intermediate
Building Web APIs with ASP.NET Corewith Chris Woodruff1h 7m Intermediate
ASP.NET Core: Test-Driven Developmentwith Richard Rout37m 30s Intermediate
1. Razor Pages Intro
What is Razor Pages?3m 5s
2. Razor Pages Basics
3. Reusing Markup with Layouts
4. Building Maintainable Applications
5. Working with Data
6. Validating User Inputs and Securing Your Application from Unauthorized Users
- 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.Cancel
Take 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.