public async Task <QueryResult <Variable> > GetVariables(VariableQuery queryObj) { var result = new QueryResult <Variable>(); var query = context.Variables .Include(v => v.VariableXls) .AsQueryable(); query = query.ApplyFiltering(queryObj); var columnsMap = new Dictionary <string, Expression <Func <Variable, object> > >() { ["variableGroup"] = v => v.VariableGroupId }; query = query.ApplyOrdering(queryObj, columnsMap); result.TotalItems = await query.CountAsync(); query = query.ApplyPaging(queryObj); result.Items = await query.ToListAsync(); return(result); }
private VariableQuery(VariableQuery other) : base(other) { _variable = other._variable; }
private VariableQuery(VariableQuery other) : base(other) { this.variable = other.variable; }
public static IQueryable <Variable> ApplyFiltering(this IQueryable <Variable> query, VariableQuery queryObj) { if (queryObj.VariableGroupId.HasValue) { query = query.Where(v => v.VariableGroupId == queryObj.VariableGroupId.Value); } return(query); }