In the current 控制器(Account)
in Edit
the method, returns 其他控制器(Treasure)
the view(MyList)
public ViewResult Edit(Treasure treasure)
{
if (ModelState.IsValid)
{
repository.SaveTreasure(treasure);
//这里返回Treasure控制器中的MyList视图
//return View();
}
return View(treasure);
}
You can use RedirectToAction()
a method, as shown below
so return RedirectToAction("MyList", "Treausre");
can.
## It is noted that, in return this RedirectToAction()
time, the type of method should be ActionResult
as follows
##代表修改的地方
public ##ActionResult## Edit(Treasure treasure)
{
if (ModelState.IsValid)
{
repository.SaveTreasure(treasure);
##return RedirectToAction("MyList", "Treausre");##
}
return View(treasure);
}