async Task SetAndLogStatusString(bool isError, string successString, Models.WooSections imprtedSection) { string _StatusMessage = isError ? $"Error Importing: {_AppUnitOfWork.GetErrorMessage()}" : // returned in there was an error importing successString; await LogImport(isError?null : 0, _StatusMessage, imprtedSection); componentPopUpRef.ShowQuickNotification(isError ? PopUpAndLogNotification.NotificationType.Error : PopUpAndLogNotification.NotificationType.Info, _StatusMessage); }
// Log the status of the import async Task LogImport(int?importedId, string sourceParameter, Models.WooSections importedSection) { IAppRepository <WooSyncLog> _WooSyncLogRepository = _AppUnitOfWork.Repository <WooSyncLog>(); await _WooSyncLogRepository.AddAsync(new WooSyncLog { // add the parameters WooSyncDateTime = _LogDate, Result = (importedId != null) ? Models.WooResults.Success : (importedId == null) ? Models.WooResults.none : Models.WooResults.Error, Parameters = sourceParameter, Section = importedSection, Notes = (importedId != null) && (importedId > 0) ? $"Imported id: {importedId}, DT: {DateTime.Now:d}" : $"DT: { DateTime.Now:d}" }); }