I'm trying to implement this method:
public async Task<IEnumerable<Product>> GetListOfProductsAsync(List<int> ids)
{
var products = await this.GetAllProductsAsync();
return products.Where(pr => ids.Contains(pr.Id));
}
I want to return a list of products where the ids match.
So for example, if I pass in [1,3,5], the method should return the products with ids 1, 3 and 5. However its not working properly.
When I execute it with only 1 id, it works fine, however when I pass in multiple ids, it fails with this error in Swagger:
{
"type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
"title": "One or more validation errors occurred.",
"status": 400,
"traceId": "00-f6d957f9875ec28236d9c5abe26500d3-00b20e33f715d7c0-00",
"errors": {
"ids": [
"The value '4,2' is not valid."
]
}
}

