First thoughts on ASP.NET MVC Preview 3
This change came with Preview 2, but it’s worth mentioning. Instead of controller actions returning void, they now return an ActionResult instance. This increases testability and separates functionality. Testability because now controllers can be tested without mocking out all the requirements for invoking the view, and functionality because the loading and invoking of an action’s view is encapsulated in a class structure apart from the controllers.
So a controller’s action could look like this:
If a controller action needed to redirect, our only option (until now) has been RedirectToAction which accepts an action name and optional controller name. That’s not bad, but now we have RedirectToRoute which allows us to redirect to a named route, making things more flexible and easier to change (without mass find/replacing all over the place).