Exemplo n.º 1
0
        public async Task <IReadOnlyList <TraceDto> > GetActiveTracesAsync(DateTime from, DateTime toDateTime)
        {
            if (from > toDateTime)
            {
                throw new BusinessValidationException(TextConstants.DateIntervalErrorMessage);
            }

            var fromLocalDate = LocalDate.FromDateTime(from);
            var toLocalDate   = LocalDate.FromDateTime(toDateTime);

            var traces = await _traceRepository.GetAllTracesForTenantAsync(t =>
                                                                           t.State == TraceState.Active &&
                                                                           t.DueDate >= fromLocalDate &&
                                                                           t.DueDate <= toLocalDate);

            return(ConvertToTraceDto(traces));
        }