2011-04-10 04:44:01 +02:00
|
|
|
|
using System.Collections.Generic;
|
2011-03-09 08:40:48 +01:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using NzbDrone.Core.Repository;
|
|
|
|
|
using SubSonic.Repository;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Providers
|
|
|
|
|
{
|
2011-04-08 17:10:46 +02:00
|
|
|
|
public class RootDirProvider
|
2011-03-09 08:40:48 +01:00
|
|
|
|
{
|
|
|
|
|
private readonly IRepository _sonioRepo;
|
|
|
|
|
|
|
|
|
|
public RootDirProvider(IRepository sonicRepo)
|
|
|
|
|
{
|
|
|
|
|
_sonioRepo = sonicRepo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region IRootDirProvider
|
|
|
|
|
|
2011-04-08 17:10:46 +02:00
|
|
|
|
public virtual List<RootDir> GetAll()
|
2011-03-09 08:40:48 +01:00
|
|
|
|
{
|
|
|
|
|
return _sonioRepo.All<RootDir>().ToList();
|
|
|
|
|
}
|
|
|
|
|
|
2011-04-08 17:10:46 +02:00
|
|
|
|
public virtual void Add(RootDir rootDir)
|
2011-03-09 08:40:48 +01:00
|
|
|
|
{
|
|
|
|
|
_sonioRepo.Add(rootDir);
|
|
|
|
|
}
|
2011-04-10 04:44:01 +02:00
|
|
|
|
|
2011-04-08 17:10:46 +02:00
|
|
|
|
public virtual void Remove(int rootDirId)
|
2011-03-09 08:40:48 +01:00
|
|
|
|
{
|
|
|
|
|
_sonioRepo.Delete<RootDir>(rootDirId);
|
|
|
|
|
}
|
2011-04-10 04:44:01 +02:00
|
|
|
|
|
2011-04-08 17:10:46 +02:00
|
|
|
|
public virtual void Update(RootDir rootDir)
|
2011-03-09 08:40:48 +01:00
|
|
|
|
{
|
|
|
|
|
_sonioRepo.Update(rootDir);
|
|
|
|
|
}
|
2011-04-10 04:44:01 +02:00
|
|
|
|
|
2011-04-08 17:10:46 +02:00
|
|
|
|
public virtual RootDir GetRootDir(int rootDirId)
|
2011-03-11 10:04:56 +01:00
|
|
|
|
{
|
|
|
|
|
return _sonioRepo.Single<RootDir>(rootDirId);
|
|
|
|
|
}
|
|
|
|
|
|
2011-03-09 08:40:48 +01:00
|
|
|
|
#endregion
|
|
|
|
|
}
|
2011-04-10 04:44:01 +02:00
|
|
|
|
}
|