我想知道,有没有一种方法可以将Model
作为参数传递给RedirectToAction
。
例如:
public class Student{
public int Id{get;set;}
public string Name{get;set;}
}
控制器
public class StudentController : Controller
{
public ActionResult FillStudent()
{
return View();
}
[HttpPost]
public ActionResult FillStudent(Student student1)
{
return RedirectToAction("GetStudent","Student",new{student=student1});
}
public ActionResult GetStudent(Student student)
{
return View();
}
}
我的问题 - 我能在RedirectToAction中传递学生模型吗?
FillStudent
函数中获取模型值。 - Amit