。net MVC——从另一个控制器动作调用一个控制器动作

时间:2021-12-21 20:37:58

I have a controller action which I would like to call another controller action.

我有一个控制器动作我想调用另一个控制器动作。

Is this a valid thing to do. Is it possible?

这是正确的做法吗?是可能的吗?

2 个解决方案

#1


31  

Controller.RedirectToAction

Controller.RedirectToAction

#2


6  

As @Justice says you can use RedirectToAction. Also, you can use TempData to pass model (and other) data between controller actions.

正如@Justice所说,您可以使用RedirectToAction。此外,您可以使用TempData在控制器动作之间传递模型(和其他)数据。

#1


31  

Controller.RedirectToAction

Controller.RedirectToAction

#2


6  

As @Justice says you can use RedirectToAction. Also, you can use TempData to pass model (and other) data between controller actions.

正如@Justice所说,您可以使用RedirectToAction。此外,您可以使用TempData在控制器动作之间传递模型(和其他)数据。