I am fairly new to ASP.NET Web API.
I am trying to build an API method that can handle multiple values for a single parameter from a search client.
The criteria needs to be a OR search for eg. A color search for Red OR Blue OR Green.
I pass the colors as integer to my method. Please find my controller method below which fails to compile with the following error
Errors:
Error 1 'int' does not contain a definition for 'Contains' and the best extension method overload 'System.Linq.ParallelEnumerable.Contains(System.Linq.ParallelQuery, TSource)' has some invalid arguments
Error 2 Instance argument: cannot convert from 'int' to 'System.Linq.ParallelQuery'
Code:
public IQueryable<Items> GetItemByColour(string Colour)
{
int[] intArr = Array.ConvertAll(Colour.Split(','), s => int.Parse(s));
var query = from a in db.Items
where a.ItemsColour.Contains(intArr)
select a;
return query;
}