Chapter 4. Action-packed controllers

 

This chapter covers
  • What makes a controller
  • What belongs in a controller
  • Manually mapping view models
  • Validating user input
  • Using the default unit test project

 

In the last couple of chapters, we’ve looked at the basics of creating a simple Guest-book application and at different options available for passing data to views. In this chapter, we’ll finish off the Guestbook example by looking at controllers in a bit more detail. We’ll explore what should (and shouldn’t) be part of a controller and look at how to manually construct view models, validate simple user input, and write controller actions that don’t use a view. This will give us a good set of building blocks for constructing the most common ...

Get ASP.NET MVC 4 in Action now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.