I want to do this:
var test = SqlCompact("OrderID", "ASC")
So this should sort the following join query by order ID:
var result = (from od in orders
join em in employees on od.EmployeeID equals em.EmployeeID
join ct in customers on od.CustomerID equals ct.CustomerID
//orderby em.EmployeeID
select new
{
od.OrderID,
od.ShipCountry,
ct.CompanyName,
ct.ContactName,
FullName = em.FirstName + ' '+ em.LastName,
}).ToList();
My attempt:
var result2 = result.ToList();
if (sort == "OrderID"){
result2 = result.OrderBy("OrderID");
}
But I get the error:
'System.Collections.Generic.List' does not contain a definition for 'OrderBy' and the best extension method overload 'System.Linq.Dynamic.DynamicQueryable.OrderBy(System.Linq.IQueryable, string, params object[])' has some invalid arguments