I would like my users to be able to search for purchase orders (which are INT's) via partial strings, i.e. if a purchase order is 123456 typing in 456 gives me 123456 in the results.
I thought this would work:
var pop = (from po in ctx.PurchaseOrders
let poid = po.PurchaseOrderID.ToString()
where poid.Contains(term)
select new SearchItem
{
id = poid,
label = po.SupplierID,
category = "purchaseorder"
}).ToList();
But I get an error
LINQ to Entities does not recognize the method 'System.String ToString()' method, and this method cannot be translated into a store expression.
How can I convert the INT PurchaseOrderID to a string to enable me to search for fragments of it?
Thanks