public async Task <IEnumerable <ProductTransaction> > GetAsync() { IEnumerable <ProductTransaction> transactions; try { transactions = await _onlineRepository.GetAll(); if (!transactions.Any()) { _logger.Log( LogLevel.Information, "No se obtuvo información de transacciones online. Usando servicio local."); transactions = await _localRepository.GetAll(); } _localRepository.Refresh(transactions); } catch (Exception ex) { _logger.Log( LogLevel.Warning, ex, "Error obteniendo información de transacciones local."); Debug.WriteLine($"Ha ocurrido un error: {ex.Message}"); transactions = await _localRepository.GetAll(); } return(transactions); }
public async Task <IEnumerable <CurrencyRate> > GetAsync() { IEnumerable <CurrencyRate> rates; try { rates = await _onlineRepository.GetAll(); if (!rates.Any()) { _logger.Log( LogLevel.Information, "No se obtuvo información de rates online. Usando servicio local."); rates = await _localCurrencyRateRepository.GetAll(); } _localCurrencyRateRepository.Refresh(rates); } catch (Exception ex) { _logger.Log( LogLevel.Warning, ex, "Error obteniendo información de rates online. Usando servicio local."); rates = await _localCurrencyRateRepository.GetAll(); } return(rates); }