I got an error message when I tried to query array of IDs in controller action. Here is the error message: string[] does not contain a definition for "contains" and the best extension method overload 'Queryable.contains, Guid)' requires a receiver of type ''. My code is:
public ActionResult GetNews(string[] IDs)
{
using (DataContext db = new DataContext())
{
var qry = db.News.Where(x => IDs.Contains(x.ID)).ToList();
...
}
}
There is a red line under IDs. IDs is an array passed from View. ID is Guid datatype. Please advice. Thanks.
string[]to contain aGuid.GetNews(string[] IDs)would becomeGetNews(List<int> IDs)...