protected async Task <WebApiEntity.UDSLog> InsertLogAsync(WebApiEntity.UDSLog log) { try { return(await _webApiClient.PostEntityAsync(log)); } catch (Exception ex) { _logger.WriteError(ex, LogCategories); throw ex; } }
protected WebApiEntity.UDSLog MapLog(UDSLogModel localLog) { WebApiEntity.UDSLog webApiLog = new WebApiEntity.UDSLog { IdUDS = localLog.UDSId, LogDescription = localLog.LogDescription, RegistrationDate = localLog.LogDate, SystemComputer = localLog.SystemComputer, RegistrationUser = localLog.SystemUser, LogType = (WebApiEntity.UDSLogType)Enum.Parse(typeof(WebApiEntity.UDSLogType), localLog.LogType.ToString()) }; return(webApiLog); }
protected async Task InsertLogAsync(UDSEntityModel model, Guid udsRepositoryId, int environment) { if (model == null || model.Logs == null || !model.Logs.Any()) { return; } try { foreach (UDSLogModel log in model.Logs) { WebApiEntity.UDSLog webApiLog = MapLog(log); webApiLog.Entity = new WebApiEntity.UDSRepository(udsRepositoryId); webApiLog.Environment = environment; await InsertLogAsync(webApiLog); } } catch (Exception ex) { _logger.WriteError(new LogMessage(string.Format("InsertLogAsync -> Errore in inserimento log: {0}", ex.Message)), LogCategories); throw ex; } }