public IActionResult Index() { var broker = new BitCoinServiceBroker(); var price = broker.GetBitCoinPrices(); _bitCoinUnitOfWork.BitCoinPriceRepository.Add(price); _bitCoinUnitOfWork.Save(); return(View()); }
protected override async Task ExecuteAsync(CancellationToken stoppingToken) { while (!stoppingToken.IsCancellationRequested) { _broker = new BitCoinServiceBroker(); var price = _broker.GetBitCoinPrices(); _unitOfWork.BitCoinPriceRepository.Add(price); _unitOfWork.Save(); _logger.LogInformation(price.time.updated + " " + price.bpi.USD); await Task.Delay(60000, stoppingToken); } }