Example #1
0
        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);
        }
Example #2
0
 private VariableQuery(VariableQuery other) : base(other)
 {
     _variable = other._variable;
 }
Example #3
0
 private VariableQuery(VariableQuery other)
     : base(other)
 {
     this.variable = other.variable;
 }
Example #4
0
        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);
        }