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/NzbDrone.Api/RootFolders/RootFolderModule.cs

34 lines
991 B

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);
}
}
}