I have repository class in asp.net mvc which has this,
public Material GetMaterial(int id)
{
return db.Materials.SingleOrDefault(m => m.Mat_id == id);
}
And my controller has this for details action result,
ConstructionRepository consRepository = new ConstructionRepository();
public ActionResult Details(int id)
{
Material material = consRepository.GetMaterial(id);
return View();
}
But why i get this error,
The parameters dictionary contains a null entry for parameter 'id' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult Details(Int32)' in 'CrMVC.Controllers.MaterialsController'. To make a parameter optional its type should be either a reference type or a Nullable type.
Parameter name: parameters
Any suggestion...