Пример #1
0
        public static ExpressionStarter <Device> GetPredicate(this QDevice query)
        {
            var predicate = PredicateBuilder.New <Device>(true);

            if (query.Display != null)
            {
                predicate = predicate.And(o => o.Display == query.Display);
            }
            if (!string.IsNullOrWhiteSpace(query.Name))
            {
                predicate = predicate.And(o => o.Name.Contains(query.Name));
            }
            return(predicate);
        }
Пример #2
0
        public async Task <PagedResult <PTCStore.Models.Device> > Devices(PTCStore.QueryModels.QDevice query, int page, int pageSize = 10)
        {
            var rs = _context.Devices.Include(o => o.VandorDevices).ThenInclude(q => q.Vandor).Where(query.GetPredicate());//.Select(o=>new RPurchase());

            return(await rs.GetPagedAsync(pageSize, page, query.Sort));
        }