I created a web method where it will take parameters like this
public HttpResponseMessage MakeOrders([FromUri] int[] orderId)
{
}
for which the request will be like this
http://www.test.com/MakeOrders?orderId=1&orderId=2
I need to pass these orderId's to DAL. So i have 2 questions
[FromUri]Is this the proper implementation or is this the standard way of practice for passing array values in query string?- Do i need to loop
orderId'sand pass to DAL as a single element so that i can make my DAL like this
DAL
public void UpdateOrder(int OrderId)
{
var query = 'Update tbl SET isApproved=1 WHERE OrderId=@orderid';
}
or do i need to send as a array like this
public void UpdateOrder(int[] OrderId)
{
var query = 'Update tbl SET isApproved=1 WHERE OrderId in (@orderid)';
}
The First Answer is:
I thought the better way to do is to pass List in json format
For example:
Pass this value using $.ajax() method of jquery.
Second answer would be: