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:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user