Asp.net MVC 2, MvcContrib, and the redirected base controller

I have a basic controller that takes a couple of generics, nothing more.

public class SystemBaseController<TForm, TFormViewModel> : Controller
    where TForm : class, IForm
    where TFormViewModel : class, IViewModel

OK, never mind. I have a method "CompleteForm" that takes in viewModel, looks like this ...

    public ActionResult CompleteForm(TFormViewModel viewModel)
    {
          //does some stuff

          return this.RedirectToAction(c => c.FormInfo(viewModel));
    }

The problem is that the controller that inherits this in this way

public class SalesFormController :  SystemBaseController<SalesForm, SalesViewModel>
{ }

I am getting an error from MvcContrib. The name of the controller should end on "Controller" at this point ...

    public RedirectToRouteResult(Expression<Action<T>> expression)
        : this(expression, expr => Microsoft.Web.Mvc.Internal.ExpressionHelper.GetRouteValuesFromExpression(expr)) {}

The correct expression is (SystemBaseController blahblah), but I'm not sure why its 1.) saying that there is no controller at the end, and 2.) if I pulled everything into the controller (from the database), it works just fine. Do I need to write or configure some kind of custom action filter or what am I missing?

+3
1

, , , , .

MvcContrib , , -, . , this.RedirectToAction(c => c.FormInfo(viewModel));, , T SystemBaseController<TForm, TFormViewModel>, SalesFormController.

SystemBaseController<TForm, TFormViewModel, TController>, this.RedirectToAction<TController>(c => c.FormInfo(viewModel));. .

+2

Source: https://habr.com/ru/post/1737367/


All Articles