private static IQueryable<vw_gui_User> GetUsersOrderedQuery(IQueryable<vw_gui_User> query, string sortExpression, bool asc) { switch (sortExpression) { case "Username": { query = asc ? query.OrderBy(users => users.Username) : query.OrderByDescending(users => users.Username); break; } case "email": { query = asc ? query.OrderBy(users => users.email) : query.OrderByDescending(users => users.email); break; } case "Total": { query = asc ? query.OrderBy(users => users.Total) : query.OrderByDescending(users => users.Total); break; } case "RealBalance": { query = asc ? query.OrderBy(users => users.RealBalance) : query.OrderByDescending(users => users.RealBalance); break; } case "BonusMoney": { query = asc ? query.OrderBy(users => users.BonusMoney) : query.OrderByDescending(users => users.BonusMoney); break; } case "PartnerProgram": { query = asc ? query.OrderBy(users => users.PartnerProgram) : query.OrderByDescending(users => users.PartnerProgram); break; } case null: default: sortExpression = null; break; } if (sortExpression != null) { var ordered = ((IOrderedQueryable<vw_gui_User>)query); query = ordered.ThenBy(users => users.id); } else query = query.OrderBy(users => users.id); return query; }
public List<Artefact> Select(int StartIndex, int PageSize, string SortExpression, bool SortDirection) { using (ZADataContext db = new ZADataContext()) { ///How to implement this method without cases to process SortExpression? } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)