Ejemplo n.º 1
0
            public async Task <Unit> Handle(UpdateActiveTransLinesDataCommand request, CancellationToken cancellationToken)
            {
                List <TransLine> tLines = await _context.TransLines.Where(tl => tl.IsActive).ToListAsync();

                EdnaFetcher fetcher = new EdnaFetcher();

                foreach (TransLine tLine in tLines)
                {
                    RTValue pntData = fetcher.FetchRealTimeData(tLine.EdnaId);
                    if (pntData != null)
                    {
                        tLine.RealValue = pntData.Dval;
                        _context.Attach(tLine).State = EntityState.Modified;
                        await _context.SaveChangesAsync();
                    }
                }
                _appStatus.LastTransLinesUpdated = DateTime.Now;
                return(Unit.Value);
            }
Ejemplo n.º 2
0
            public async Task <Unit> Handle(UpdateActiveIctsDataCommand request, CancellationToken cancellationToken)
            {
                List <Ict> icts = await _context.Icts.Where(i => i.IsActive).ToListAsync();

                EdnaFetcher fetcher = new EdnaFetcher();

                foreach (Ict ict in icts)
                {
                    RTValue pntData = fetcher.FetchRealTimeData(ict.EdnaId);
                    if (pntData != null)
                    {
                        ict.RealValue = pntData.Dval;
                        _context.Attach(ict).State = EntityState.Modified;
                        await _context.SaveChangesAsync();
                    }
                }
                _appStatus.LastIctsUpdated = DateTime.Now;
                return(Unit.Value);
            }