Exemplo n.º 1
0
        public async Task <Paginated <ConsumeReading> > Get(Domain.ConsumeFilter filter)
        {
            var query = _database.Consume.AsQueryable()
                        .Filter(filter)
                        .AsNoTracking();

            return(new Paginated <ConsumeReading>
            {
                Total = await query.CountAsync(),
                Result = (await query.ToListAsync()).Select(c => new ConsumeReading
                {
                    Id = c.Id,
                    Barcode = c.Barcode,
                    Product = GetBrand(c),
                    TimeStamp = c.TimeStamp
                }).ToList()
            });
        }
Exemplo n.º 2
0
        public static IQueryable <Domain.Models.Consume> Filter(this IQueryable <Domain.Models.Consume> q, Domain.ConsumeFilter filter)
        {
            if (filter.From.HasValue)
            {
                q = q.Where(c => c.TimeStamp >= filter.From.Value);
            }

            return(q);
        }