1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-19 21:46:50 -04:00

Fixed: Saving settings changes

This commit is contained in:
Mark McDowall
2015-11-26 12:05:37 -08:00
parent c2b9504b15
commit c8a0f9fa7a
3 changed files with 20 additions and 8 deletions
@@ -8,7 +8,7 @@ namespace NzbDrone.Core.Configuration
public interface IConfigRepository : IBasicRepository<Config>
{
Config Get(string key);
Config Upsert(string key, string value);
}
public class ConfigRepository : BasicRepository<Config>, IConfigRepository
@@ -23,5 +23,19 @@ namespace NzbDrone.Core.Configuration
{
return Query.Where(c => c.Key == key).SingleOrDefault();
}
public Config Upsert(string key, string value)
{
var dbValue = Get(key);
if (dbValue == null)
{
return Insert(new Config {Key = key, Value = value});
}
dbValue.Value = value;
return Update(dbValue);
}
}
}