1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2025-01-06 06:41:40 +02:00
Sonarr/NzbDrone.Api/RootFolders/RootFolderModule.cs

34 lines
972 B
C#
Raw Normal View History

using System.Collections.Generic;
2013-02-04 07:18:59 +03:00
using NzbDrone.Core.RootFolders;
2013-01-24 23:48:44 +03:00
namespace NzbDrone.Api.RootFolders
2013-01-24 23:48:44 +03:00
{
public class RootFolderModule : NzbDroneRestModule<RootFolderResource>
2013-01-24 23:48:44 +03:00
{
2013-02-04 07:18:59 +03:00
private readonly RootFolderService _rootFolderService;
2013-01-24 23:48:44 +03:00
public RootFolderModule(RootFolderService rootFolderService)
2013-01-24 23:48:44 +03:00
{
2013-02-04 07:18:59 +03:00
_rootFolderService = rootFolderService;
2013-01-24 23:48:44 +03:00
GetResourceAll = GetRootFolders;
CreateResource = CreateRootFolder;
DeleteResource = DeleteFolder;
2013-01-24 23:48:44 +03:00
}
private RootFolderResource CreateRootFolder(RootFolderResource rootFolderResource)
2013-01-24 23:48:44 +03:00
{
return Apply<RootFolder>(_rootFolderService.Add, rootFolderResource);
2013-01-24 23:48:44 +03:00
}
private List<RootFolderResource> GetRootFolders()
2013-01-24 23:48:44 +03:00
{
2013-04-25 07:27:49 +03:00
return ApplyToList(_rootFolderService.All);
2013-01-24 23:48:44 +03:00
}
private void DeleteFolder(int id)
{
_rootFolderService.Remove(id);
}
2013-01-24 23:48:44 +03:00
}
}