added settings view to mvc project

This commit is contained in:
kay.one 2010-09-23 22:21:45 -07:00
parent 941d516e42
commit d7bae9135c
15 changed files with 89 additions and 148 deletions

View file

@ -9,6 +9,7 @@ namespace NzbDrone.Core.Controllers
{
public class DbConfigController : IConfigController
{
private const string _seriesroots = "SeriesRoots";
private readonly IDiskController _diskController;
private readonly ILog _logger;
private readonly IRepository _sonicRepo;
@ -21,20 +22,27 @@ namespace NzbDrone.Core.Controllers
_sonicRepo = dataRepository;
}
#region IConfigController Members
public List<String> GetTvRoots()
{
return (GetValue("tvRoot").Trim(';').Split(';').Where(path => _diskController.Exists(path))).ToList();
}
#endregion
private string GetValue(string key)
{
return GetValue(key, String.Empty, false);
}
public String SeriesRoot
{
get
{
return GetValue(_seriesroots);
}
set
{
SetValue(_seriesroots, value);
}
}
private string GetValue(string key, object defaultValue, bool makePermanent)
{
string value;
@ -62,7 +70,7 @@ namespace NzbDrone.Core.Controllers
{
_logger.DebugFormat("Writing Setting to file. Key:'{0}' Value:'{1}'", key, value);
_sonicRepo.Add(new Config {Key = key, Value = value});
_sonicRepo.Add(new Config { Key = key, Value = value });
}
}
}