public async Task UpdateCryptoCurrenciesAsync() { using (CurrentUnitOfWork.DisableFilter(AbpDataFilters.MayHaveTenant)) { try { var supportedCurrenciesQueryable = _supportedCurrenciesRepository.GetAll(); var currenciesQueryable = _currenciesRepository.GetAll(); var supportedCurrencies = supportedCurrenciesQueryable.Join(currenciesQueryable, sc => sc.CurrencyId, c => c.Id, (sc, c) => new { SupportCurrency = sc, Currency = c }).Where(o => o.Currency.IsCrypto).ToList(); var cryptoCurrencies = await DownloadCryptoCurrenciesAsync(); foreach (var obj in supportedCurrencies) { var cryptoCurrency = cryptoCurrencies.FirstOrDefault(cc => cc.Code.Equals(obj.Currency.Code)); if (cryptoCurrency != null) { cryptoCurrencies.Remove(cryptoCurrency); } } if (cryptoCurrencies.Count == 0)//TODO: need ask about that case { return; } var currencies = cryptoCurrencies.Select(c => CurrencyMapper(c)).ToList(); //TODO: add symbols download await _currenciesRepository.DeleteNotSupportedCryptoCurrenciesAsync(); await _currenciesRepository.InsertRangeAsync(currencies); } catch (Exception ex) { Logger.Error(String.Empty, ex); } } }