Calling another Web API controller directly from inside another Web API controller

后端 未结 3 1064
死守一世寂寞
死守一世寂寞 2021-02-04 13:38

Given a controller Proxy and an action of GetInformation. I want to be able to call the method GetInformation of the Users c

3条回答
  •  心在旅途
    2021-02-04 14:30

    You should do something like this in your UsersController

    public HttpResponseMessage GetInformation(InformationRequest request)
    {
        HttpResponseMessage resp ;
    
        resp = UserBusinessLogic.GetInformation(request) ;
    
        return resp ;
    }
    

    and from your ProxyController you can resuse that "UserBusinessLogic" method to obtain the same information using the same code snippet.

提交回复
热议问题