List of Listings

 

Chapter 2. Hello MVC world

Listing 2.1. The default HomeController

Listing 2.2. Registering routes

Listing 2.3. The DbContext used for interacting with the database

Listing 2.4. The GuestbookController with a Create action

Listing 2.5. The contents of the Create view

Listing 2.6. Processing the form data using a controller action

Listing 2.7. Adding the Index action

Listing 2.8. Displaying guestbook entries

Listing 2.9. The default layout

Chapter 3. View fundamentals

Listing 3.1. The Show controller action

Listing 3.2. Using ViewData information to hide a link

Listing 3.3. Skeleton definition of WebViewPage<T>

Listing 3.4. Passing a collection of guestbook entries to the view

Listing 3.5. Displaying a guestbook entry in our view

Listing 3.6. Our LogOnModel class

Listing 3.7. Rendering the account information input form

Listing 3.8. HTML generated from expression-based HtmlHelper methods

Listing 3.9. The signature of the LogOn action using the view model as a parameter

Listing 3.10. Using EditorForModel for a simple model

Listing 3.11. The Change Password model

Listing 3.12. Using EditorFor for extra layout control

Listing 3.13. The template markup for our ChangePasswordModel template

Listing 3.14. Creating a custom Object template

Chapter 4. Action-packed controllers

Listing 4.1. The Index action of the GuestbookController

Listing 4.2. Implementing IController manually

Listing 4.3. Projecting guestbook data into a view model