Esempio n. 1
0
        public async Task <List <ServiceDTO> > GetAsync(CancellationToken cancellationToken)
        {
            var services = await _cache.GetOrAddAsync <List <ServiceDTO> >(KakaduConstants.SERVICES, async (options) => {
                options.AbsoluteExpirationRelativeToNow = TimeSpan.FromMinutes(3);

                var entities = await Task.Run(() => _service.GetAll(), cancellationToken);
                return(_mapper.Map <List <ServiceDTO> >(entities));
            }, token : cancellationToken);

            // get recording status
            var statuses = (await _actionApiService.GetStatusesAsync(cancellationToken)).ToList();

            foreach (var serviceDto in services)
            {
                var status = statuses.FirstOrDefault(s => s.ServiceCode == serviceDto.Code);
                if (status == null)
                {
                    continue;
                }

                serviceDto.IsRecording = status.Results.All(r => r.Result is bool bresult && bresult == true);
            }

            return(services);
        }
Esempio n. 2
0
        public async Task <IEnumerable <ServiceCaptureResultDTO> > GetStatusesAsync(CancellationToken cancellationToken)
        {
            var actionResult = await _actionApiService.GetStatusesAsync(cancellationToken);

            return(actionResult);
        }