Beispiel #1
0
        /// <summary>
        /// Creates a new config entry
        /// </summary>
        /// <param name="configEntry">Config entry to create</param>
        /// <returns>Created config entry, with filled id</returns>
        public async Task <TaleConfigEntry> CreateConfig(TaleConfigEntry configEntry)
        {
            configEntry.Id = Guid.NewGuid().ToString();
            await _ConfigCollection.InsertOneAsync(configEntry);

            return(configEntry);
        }
Beispiel #2
0
        /// <summary>
        /// Gets a config by key
        /// </summary>
        /// <param name="projectId">Project id</param>
        /// <param name="key">Config key</param>
        /// <returns>Config</returns>
        public async Task <TaleConfigEntry> GetConfigByKey(string projectId, string key)
        {
            TaleConfigEntry configEntry = await _ConfigCollection.Find(p => p.ProjectId == projectId && p.Key == key).FirstOrDefaultAsync();

            return(configEntry);
        }
Beispiel #3
0
 /// <summary>
 /// Updates a config entry
 /// </summary>
 /// <param name="configEntry">Config entry to update</param>
 /// <returns>Task</returns>
 public async Task UpdateConfig(TaleConfigEntry configEntry)
 {
     ReplaceOneResult result = await _ConfigCollection.ReplaceOneAsync(p => p.Id == configEntry.Id, configEntry);
 }