I am trying to retrieve data from the server, after sending multiple parameters to the server. this is my Web API Config:
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
In my controller I have 2 GET sections:
public IEnumerable<string> Get()
{
return new string[] { "value1", "value2" };
}
// GET api/<controller>/5
public List<Object> Get( string p1, string p2, string p3, string p4,
string p5, string p6, string p7)
{
//Do Some Code
}
I want to call the GET with multiple parameters so I do it like this:
self.SearchFunc = function (P1, P2, P3, P4, P5, P6, P7) {
var promise = _$http({
method: "GET",
url: 'api/Order',
params: {
"P1": P1, "P2": P2,
"P3": P3, "P4": P4,
"P5": P5, "P6": P6,
"P7":P7
}
}).success(function (data, status, headers, config) {
}).error(function (data, status, headers, config) {
});
return promise;
};
First of all is this the right way to send many parametrs in order to get data from the server? I tried this way, but the debug shows that the code enters the first GET.