here's my code and I'm hoping someone could enlighten me :
public async Task<ActionResult> Search()
{
NameValueCollection filter = HttpUtility.ParseQueryString(Request.Params.ToString());
string term = filter["term"];
var query = db.ProductGraphicsCards
.Where(pgc => pgc.GraphicsCardSKU.StartsWith(term))
.Select(pgc => new ProductGraphicsCard()
{
GraphicsCardSKU = pgc.GraphicsCardSKU,
GraphicsCardMemory = pgc.GraphicsCardMemory
};
var products = await query.ToListAsync();
List<string> items = new List<string>();
foreach (var product in products)
{
items.Add(product.GraphicsCardSKU + " / " + product.GraphicsCardMemory.ToString());
}
return Json(items, JsonRequestBehavior.AllowGet);
}
gives me an error and I can't understand why