Tharindu Senanayake Tharindu Senanayake - 5 months ago 22
SQL Question

Passing multiple array values to a web api controller using a single model attribute

I have a $scope object as bellow


What I want to do is pass these values to the following SQL query

Select * from table where ID in("Here I need the above 3 values one after another")

How can I do this?


Create a class

public class myId {
  public int ID {set;get;}

pass it to web api

public void submitID(List<myId> ids){
  // do rest of the things
  var id = string.Join(",", ids.Select(x => x.ID).ToArray());
  var query="Select * from table where ID in('"+id+"')";