O'Reilly logo

ASP.NET MVC 4 in Action: Revised edition of ASP.NET MVC 2 in Action by Foreword by Phil Haack, Jeffrey Palermo, Jimmy Bogard, Eric Hexter, Matthew Hinze, and Jeremy Skinner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required