private static KendoUiGridResult <T> ReturnGridData <T>(KendoUiGridParam requestParam, ref IQueryable <T> collection) { List <T> gridData = new List <T>(); try { //If the sort Order is provided perform a sort on the specified column if (!String.IsNullOrEmpty(requestParam.SortOrd)) { var sortCollection = Sort <T>(collection, requestParam.SortOn, requestParam.SortOrd); //If sort and paging gridData = sortCollection.Skip(requestParam.Skip).Take(requestParam.PageSize).ToList(); } else { //If only paging gridData = collection.Skip(requestParam.Skip).Take(requestParam.PageSize).ToList(); } } catch { } return(new KendoUiGridResult <T> { Data = gridData.Count > 0 ? gridData : collection.ToList(), Total = collection.Count() }); }
public static KendoUiGridResult <T> ParseGridData <T>(IQueryable <T> collection, KendoUiGridParam requestParam) { return(ReturnGridData <T>(requestParam, ref collection)); }