public PagedResponse <RecompenseDto> Execute(RecompenseSearch search)
        {
            var query = _context.Recompenses.Include(x => x.Issuance).AsQueryable();

            if (search.ExistDamage.HasValue)
            {
                query = query.Where(x => x.ExistDamage == search.ExistDamage.Value);
            }

            if (search.ExistTransgression.HasValue)
            {
                query = query.Where(x => x.ExistTransgression == search.ExistTransgression.Value);
            }

            if (search.MinPrice.HasValue)
            {
                query = query.Where(x => x.TotalPrice >= search.MinPrice.Value);
            }

            if (search.MaxPrice.HasValue)
            {
                query = query.Where(x => x.TotalPrice <= search.MaxPrice.Value);
            }

            return(query.Paged <RecompenseDto, Domain.Recompense>(search, _mapper));
        }
Esempio n. 2
0
 public IActionResult Get([FromQuery] RecompenseSearch search, [FromServices] IGetRecompenses query)
 {
     return(Ok(_executor.ExecuteQuery(query, search)));
 }