1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2024-12-28 10:37:41 +00:00
Lidarr/NzbDrone.Api/RootFolders/RootFolderModule.cs
2013-05-12 21:25:36 -07:00

34 lines
No EOL
991 B
C#

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