i have a problem in MVC ASP.NET project. i work with LINQ technology.When i want to insert one record to table,this error is shown.although insert action is preformed:**
ERROR:
Server Error in '/' Application. The parameters dictionary contains a null entry for parameter 'id' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult Index(Int32)' in 'MVCJahan_oil.Controllers.getehController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter. Parameter name: parameters Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
controller methods for insert(create):
public ActionResult Index(int id)
{
var query= from gete in l_class.getehs where gete.request_no == id select gete;
this.Session["req_no"] = id;
return View(query.ToList());
}
[HttpPost]
public ActionResult Create([Bind(Exclude = "id")]geteh gte)
{
try
{
l_class.getehs.InsertOnSubmit(gte);
l_class.SubmitChanges();
return RedirectToAction("Index", new { id = System.Convert.ToInt32 (Session["req_no"].ToString()) });
}
catch
{
return View();
}
}