c# - Web api access controller method from another controller method -
i have 2 different controller --> controller a,controller b
and have different methods each controller , return values ihttpactionresult (method controller ,method b , controller b)
how can access controller method , take content controller
controller b ,and inside method b
ihttpactionresult result = controllera.methoda()
and want read result.content inside controller b
i consider using common base class 2 controllers (if there method want use on both)
for example
public class abstract mybasecontroller { public void commonmethod() { // here } }
then use them like
public class controllera : mybasecontroller { public void methoda() { base.commonmethod(); // else } } public class controllerb : mybasecontroller { public void methodb() { base.commonmethod(); // else } }
Comments
Post a Comment