Quantcast
Channel: Web API
Viewing all articles
Browse latest Browse all 4850

Call Web API Controller from MVC action by passing multiple parameters

$
0
0

 Hi,

I have  MVC controller like below. I need to call Web API controller from controller by passing multiple parameters.

public ActionResult Report()
{

     // need to call Web API from here by passing below parameter to Web API

     // Parameters need to be passed to Wev API controller: int param1,string param2,DataTable param3, string param4, string param5

   return View();
}

My Web API method is like below:

  public class TestController : ApiController {

  [HttpGet]
  public string GetJSONData(HttpRequestMessage request)
  {

       // here I need to get all the parameter and pass it to GetJSONData method below

      return GetJSONData(param1,param2,param3,param4,param5);
  }

}

Please help me to provide some example for the above.


Viewing all articles
Browse latest Browse all 4850


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>