You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Lidarr/src/NzbDrone.Core/Organizer/NamingConfigService.cs

36 lines
866 B

11 years ago
namespace NzbDrone.Core.Organizer
{
public interface INamingConfigService
{
NamingConfig GetConfig();
void Save(NamingConfig namingConfig);
}
public class NamingConfigService : INamingConfigService
{
private readonly INamingConfigRepository _repository;
11 years ago
public NamingConfigService(INamingConfigRepository repository)
11 years ago
{
_repository = repository;
}
public NamingConfig GetConfig()
{
var config = _repository.SingleOrDefault();
if (config == null)
{
_repository.Insert(NamingConfig.Default);
config = _repository.Single();
}
return config;
}
public void Save(NamingConfig namingConfig)
{
_repository.Upsert(namingConfig);
}
}
}