Esempio n. 1
0
        public async Task <QueryResult <SubVariable> > GetSubVariables(SubVariableQuery queryObj)
        {
            var result = new QueryResult <SubVariable>();

            var query = context.SubVariables
                        .AsQueryable();

            query = query.ApplyFiltering(queryObj);

            result.TotalItems = await query.CountAsync();

            query = query.ApplyPaging(queryObj);

            result.Items = await query.ToListAsync();

            return(result);
        }
Esempio n. 2
0
        public static IQueryable <SubVariable> ApplyFiltering(this IQueryable <SubVariable> query, SubVariableQuery queryObj)
        {
            if (!string.IsNullOrEmpty(queryObj.Name))
            {
                query = query.Where(v => v.Name == queryObj.Name);
            }

            return(query);
        }