重工电子论坛

标题: 【MVC】垮控制器调用的方法 [打印本页]

作者: 李维强-15级    时间: 2016-12-5 14:05
标题: 【MVC】垮控制器调用的方法


  1. using System.Web.Mvc;
  2. public ActionResult 动作方法()
  3. {
  4.     var otherController = DependencyResolver.Current.GetService<另一个控制器的类名>();
  5.     var result = otherController.另一个动作方法();
  6.     return result;
  7. }
复制代码





欢迎光临 重工电子论坛 (http://www.cqutlab.cn/) Powered by Discuz! X3.1