Exemplo n.º 1
0
        public Task <int> Count(EmissionPointPagination pagination)
        {
            var query = from e in context.EmissionPoints select e;

            if (pagination.IsActive != "-")
            {
                query = query.Where(e => e.IsActive == Boolean.Parse(pagination.IsActive));
            }
            return(query.CountAsync());
        }
        public async Task <IActionResult> Count([FromQuery] EmissionPointPagination query)
        {
            var count = await repository.Count(query);

            return(Json(new StandardResponse
            {
                Status = 200,
                Data = count
            }));
        }
Exemplo n.º 3
0
        public Task <List <EmissionPoint> > Get(EmissionPointPagination pagination)
        {
            var query = from e in context.EmissionPoints select e;

            if (pagination.IsActive != "-")
            {
                query = query.Where(e => e.IsActive == Boolean.Parse(pagination.IsActive));
            }

            query = query.Take(pagination.Page * pagination.Quantity);
            query = query.Skip(pagination.Page * pagination.Quantity - pagination.Quantity);
            query = query.OrderBy(e => e.Name);
            //return (
            //    from e in context.EmissionPoints
            //    select new EmissionPoint
            //    {
            //        Id = e.Id,
            //        Name = e.Name,
            //        IsActive = e.IsActive
            //    }
            //).ToListAsync();
            return(query.ToListAsync());
        }