예제 #1
0
        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));
        }
예제 #2
0
        public IActionResult Get([FromQuery] LoggerSearch search, [FromServices] IGetLogs query)
        {
            var context = new ProjectContext();

            return(Ok(_executor.ExecuteQuery(query, search)));
        }