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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.