Asp.net MVC 2, MvcContrib, and a base controller with redirect actions
- by jeriley
I've got a base controller that takes a couple generics, nothing overly fancy.
public class SystemBaseController<TForm, TFormViewModel> : Controller
where TForm : class, IForm
where TFormViewModel : class, IViewModel
ok, no big deal. I have a method "CompleteForm" that takes in the viewModel, looks kinda like this ...
public ActionResult CompleteForm(TFormViewModel viewModel)
{
//does some stuff
return this.RedirectToAction(c => c.FormInfo(viewModel));
}
Problem is, the controller that inherits this, like so
public class SalesFormController : SystemBaseController<SalesForm, SalesViewModel>
{ }
I end up getting a error from MvcContrib - Controller name must end in 'Controller' at this point ...
public RedirectToRouteResult(Expression<Action<T>> expression)
: this(expression, expr => Microsoft.Web.Mvc.Internal.ExpressionHelper.GetRouteValuesFromExpression(expr)) {}
The expression that's passed in is correct (SystemBaseController blahblah) but I'm not sure why its 1.) saying there's no controller at the end, and 2.) if I pull out everything into the controller (out of the base), works just fine. Do I need to write or setup some kind of action filter of my own or what am I missing?