private NORTHWINDDataContext _Context = new NORTHWINDDataContext(); private decimal[] GetPricesByEmployeeId(int employeeId) { decimal[] result = null; result = _Context.Orders.Where(o => o.EmployeeID == employeeId).Take(5) .Select(oo => (decimal)oo.ShipVia).ToArray(); return result; }
public JsonResult LoadData(string name) { var data = (from e in _Context.Employees.Take(10).ToList() select new { EmployeeID = e.EmployeeID, Orders = GetPricesByEmployeeId(e.EmployeeID), Name = e.FirstName, }).Distinct();
if (!string.IsNullOrEmpty(name)) { data = data.Where(d => d.Name.IndexOf(name) >= 0); }