How can I pass modelstate errors from oneaction to another in the case of an Action Delete?
public ActionResult Index()
{
ProjectTestModel model = new ProjectTestModel ();
return GetProjectView(model);
}
public ActionResult GetProjectView(ProjectTestModel model)
{
return View("Index", model);
}
public ActionResult Delete(int id)
{
try
{
test.Load(id)
test.Delete();
return RedirectToAction("Index");
}
catch (Exception e)
{
ModelState.AddModelError("Error", e.Message);
return RedirectToAction("Index");
}
}
source
share