我有以下代码:
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});
}
那么我怎样才能让它保持干燥而不重复我已经做过的事情呢?