1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-13 22:43:35 +01:00
Radarr/NzbDrone.Api/RootFolders/RootFolderModule.cs
2013-08-25 22:14:55 -07:00

34 lines
984 B
C#

using System.Collections.Generic;
using NzbDrone.Core.RootFolders;
namespace NzbDrone.Api.RootFolders
{
public class RootFolderModule : NzbDroneRestModule<RootFolderResource>
{
private readonly IRootFolderService _rootFolderService;
public RootFolderModule(IRootFolderService rootFolderService)
{
_rootFolderService = rootFolderService;
GetResourceAll = GetRootFolders;
CreateResource = CreateRootFolder;
DeleteResource = DeleteFolder;
}
private int CreateRootFolder(RootFolderResource rootFolderResource)
{
return GetNewId<RootFolder>(_rootFolderService.Add, rootFolderResource);
}
private List<RootFolderResource> GetRootFolders()
{
return ToListResource(_rootFolderService.AllWithUnmappedFolders);
}
private void DeleteFolder(int id)
{
_rootFolderService.Remove(id);
}
}
}