Call another controller associated method in MVC Controller Action

 

public ActionResult TestAction()

{

  var otherController = DependencyResolver.Current.GetService <class name of another controller> ();

  var result = otherController another operation method ();. // Action call

  var value = otherController method (); // call method

       Var statictValue = class name of the other controller. Static method () // static method invocation

  return result;

}

 

Guess you like

Origin www.cnblogs.com/jfeng/p/11344138.html