Ejemplo n.º 1
0
 public async Task AddSettingAsync(Setting setting)
 {
     try
     {
         setting.Application = this.CurrentApplication;
         setting.Environment = this.CurrentEnviroment;
         this.CurrentSettings.Add(setting);
         Settings settingsOperation             = new Settings(this.Settings4netAPI);
         APIClient.Models.Setting remoteSetting = ModelToAPIMapper.Map(setting);
         await settingsOperation.AddSettingAsync(remoteSetting).ConfigureAwait(false);
     }
     catch (Exception exp)
     {
         logger.Warn("Exception when adding setting to remote settings4net API", exp);
     }
 }
Ejemplo n.º 2
0
        private async Task <List <Setting> > LoadRemoteSettings()
        {
            if (this.CurrentSettings == null)
            {
                if (this.CurrentSettings != null)
                {
                    return(this.CurrentSettings);
                }
                else
                {
                    Settings settingsOp = new Settings(this.Settings4netAPI);
                    IList <APIClient.Models.Setting> remoteSettings = await settingsOp.GetSettingsAsync(this.CurrentApplication, this.CurrentEnviroment).ConfigureAwait(false);

                    this.CurrentSettings = ModelToAPIMapper.Map(remoteSettings).ToList();
                    return(this.CurrentSettings);
                }
            }

            return(this.CurrentSettings ?? new List <Setting>());
        }