I have a controller which inherits from a base controller and the default routing:
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
works correctly when going to /Departments/Create:
public class DepartmentsController : BaseController
{
public ActionResult Create()
{
return View("Create");
}
public abstract class BaseController : Controller
{
....
However if I try and change this to be a generic controller e.g.
public class DepartmentsController<T> : BaseController<T>
where T: class
{
public ActionResult Create()
{
return View("Create");
}
public abstract class BaseController<T> : Controller
where T: class
{
....
Then going to /Departments/Create I end up with a "The resource cannot be found" error suggesting that the action has not been found. However, when I check the routes used with routeDebugger I can see that "{controller}/{action}/{id}" has been matched yet the action has not been called:
Is there a different route or method I would have to use to be able to call the correct action?
Thanks!