1
我有以下代码:ASP.NET MVC:将数据发送到意见POST请求
public ActionResult Foo()
{
var a = "a";
return View(new FooModel { A = a});
}
[HttpPost]
public ActionResult Foo(....)
{
// I need to set all the values of the ViewModel again, not to get a null exception in the view
return View(new FooModel { A = a});
}
所以,我怎么能保持干燥和不重复,我已经做了的东西?
你怎么能知道它的工作原理,如果你不知道他是如何在视图中使用它? – 2010-08-24 12:17:29
我说,这是愚蠢的;但是这个语法也适用。我只是想知道,我可以在一个操作方法再次调用的操作方法。所以我无法理解你。你的答案当然是正确的,这只是一个实验。 – 2010-08-24 12:50:56