In WEB API 2 how to use IN Query From SQL string :
select * from TABLE where state in (x)
To
// GET: api/TABLE
public IQueryable<TABLE> GetTABLE(string x)
{
return db.TABLE.Where(c => c.state.Contains(x));
}
Something like this should work:
public IQueryable<TABLE> GetTABLE(string x)
{
var l = new List<string>() {x};
return db.TABLE.Where(c => l.Contains(c.state));
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With