- MVC 5, .NET 4.5.1
In my base Controller class I have the following defined
[AcceptVerbs(HttpVerbs.Get)]
public virtual ActionResult Edit(long Id)
{
}
This has been fine up to now. However in the new controller class which descends from above I need to change the method signature to:
[AcceptVerbs(HttpVerbs.Get)]
public new ActionResult Edit(string Id)
{
}
Note that the parameter Id is now a string. However when the action is invoked on the descendant controller I get the following error:
The parameters dictionary contains a null entry for parameter 'Id' of non-nullable type 'System.Int64' for method 'System.Web.Mvc.ActionResult Edit(Int64)' in 'XXXX.Controllers.MlControllerGridView`2[MakersLane.Web.ViewModels.Login.LoginAddEditViewModel,XXXX.Web.ViewModels.Login.LoginAddEditViewModel]'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter. Parameter name: parameters
So my question is how do I change the parameter Id to be of type string in my descendant controller and not access any base behaviour?