I suspect this is as simple as pushing the last part in an in-process request using AsEnumerable() :
var jsonData = new { total = (int)Math.Ceiling((float)totalRecords / (float)rows), page = page, records = totalRecords, rows = (from r in tabs.AsEnumerable() select new { id = r.colID, cell = new[] { r.FirstName, r.LastName } } ).ToArray() }; return Json(jsonData, JsonRequestBehavior.AllowGet);
You can extract this request from an initializer of an anonymous type, for clarity:
var rows = tabs.AsEnumerable() .Select(r => new { id = r.colID, cell = new[] { r.FirstName, r.LastName }) .ToArray(); var jsonData = new { total = (int)Math.Ceiling((float)totalRecords / (float)rows), page, records = totalRecords, rows };
source share