Exemple #1
0
        public static IQueryable <AgreegationSubVariable> ApplyFiltering(this IQueryable <AgreegationSubVariable> query, AgreegationSubVariableQuery queryObj)
        {
            if (queryObj.VariableId.HasValue)
            {
                query = query.Where(v => v.VariableId == queryObj.VariableId.Value);
            }

            return(query);
        }
Exemple #2
0
        public async Task <QueryResult <AgreegationSubVariable> > GetAgreegationSubVariablesAsync(AgreegationSubVariableQuery queryObj)
        {
            var result = new QueryResult <AgreegationSubVariable>();

            var query = context.AgreegationSubVariables
                        .AsQueryable();

            query = query.ApplyFiltering(queryObj);

            result.TotalItems = await query.CountAsync();

            query = query.ApplyPaging(queryObj);

            result.Items = await query.ToListAsync();

            return(result);
        }