如何在重定向到另一个操作时传递模型数据而不使用TemptData,如示例中所示。是否有另一种方法来传递EmployeeViewModel从"AddEmployee"的动作到"预览"的动作,而不使用TempData/Session?
public ActionResult AddEmployee(EmployeeViewModel employeeViewModel)
{
TempData["employee"] = employeeViewModel;
return this.RedirectToAction("Preview");
}
public ActionResult Preview()
{
var model = TempData["employee"] as EmployeeViewModel;
return this.View("Preview", employeeViewModel);
}
check this
return RedirectToAction("Index", new { exception = EmployeeViewModel});