public async Task <(bool Success, string FileName)> ImportDataIntoStaging() { try { _logger.LogInformation("LARS Import - data into staging - started"); var lastFilePath = _importAuditRepository.GetLastImportByType(ImportType.LarsImport); var filePath = _larsPageParser.GetCurrentLarsDataDownloadFilePath(); await Task.WhenAll(lastFilePath, filePath); if (lastFilePath.Result != null && filePath.Result.Equals( lastFilePath.Result.FileName, StringComparison.CurrentCultureIgnoreCase)) { _logger.LogInformation("LARS Import - no new data to import"); return(false, null); } await _larsImportStaging.Import(filePath.Result); _logger.LogInformation("LARS Import - data into staging - finished"); return(true, filePath.Result); } catch (Exception e) { _logger.LogError("LARS Import - an error occurred while trying to import data from LARS file.", e); throw; } }
public async Task <(bool Success, string FileName)> ImportDataIntoStaging() { try { _logger.LogInformation("LARS Import - data into staging - started"); var filePath = await _larsPageParser.GetCurrentLarsDataDownloadFilePath(); await _larsImportStaging.Import(filePath); _logger.LogInformation("LARS Import - data into staging - finished"); return(true, filePath); } catch (Exception e) { _logger.LogError("LARS Import - an error occurred while trying to import data from LARS file.", e); throw; } }