public PagedResponse <LoggerDto> Execute(LoggerSearch search) { var query = _context.UseCaseLogs.AsQueryable(); if (!string.IsNullOrEmpty(search.UseCaseName) || !string.IsNullOrWhiteSpace(search.UseCaseName)) { query = query.Where(x => x.UseCaseName.ToLower().Contains(search.UseCaseName.ToLower())); } if (search.ActorId.HasValue) { query = query.Where(x => x.ActorId == search.ActorId.Value); } if (search.DateFrom.HasValue) { query = query.Where(x => x.Date.Date >= search.DateFrom.Value.Date); } if (search.DateTo.HasValue) { query = query.Where(x => x.Date.Date <= search.DateTo.Value.Date); } query = query.OrderByDescending(x => x.Date); return(query.Paged <LoggerDto, Domain.UseCaseLog>(search, _mapper)); }
public IActionResult Get([FromQuery] LoggerSearch search, [FromServices] IGetLogs query) { var context = new ProjectContext(); return(Ok(_executor.ExecuteQuery(query, search))); }