public IQueryable<spASSESSMENT_RECORDS_Result> SortTable(AssessmentEntities context, string param, string column, string sortOrder) { ViewBag.Order = String.IsNullOrEmpty(sortOrder) ? "desc" : ""; sortOrder = String.IsNullOrEmpty(sortOrder) ? "" : sortOrder; var results = context.spASSESSMENT_RECORDS(param).AsQueryable(); Func<IQueryable<spASSESSMENT_RECORDS_Result>, Expression<Func<spASSESSMENT_RECORDS_Result, string>>, IOrderedQueryable<spASSESSMENT_RECORDS_Result>> orderBy; if (!sortOrder.Equals("desc")) { orderBy = Queryable.OrderBy; } else { orderBy = Queryable.OrderByDescending; } results = orderBy(results, spASSESSMENT_RECORDS_Result.Order(column)) .ThenBy(searchResults => searchResults.OUTCOMES); return results; }
public IQueryable<spASSESSMENT_RECORDS_Result> getAllRecords(AssessmentEntities context, string param) { return context.spASSESSMENT_RECORDS(param).AsQueryable(); }