mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-19 21:13:28 -07:00
Release restrictions
New: Required terms assignable to series via tags New: Ignored terms assignable to series via tagss
This commit is contained in:
parent
d6ed475c63
commit
53c2962d2a
38 changed files with 794 additions and 185 deletions
49
src/NzbDrone.Api/Restrictions/RestrictionModule.cs
Normal file
49
src/NzbDrone.Api/Restrictions/RestrictionModule.cs
Normal file
|
@ -0,0 +1,49 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.Api.Mapping;
|
||||
using NzbDrone.Core.Restrictions;
|
||||
|
||||
namespace NzbDrone.Api.Restrictions
|
||||
{
|
||||
public class RestrictionModule : NzbDroneRestModule<RestrictionResource>
|
||||
{
|
||||
private readonly IRestrictionService _restrictionService;
|
||||
|
||||
|
||||
public RestrictionModule(IRestrictionService restrictionService)
|
||||
{
|
||||
_restrictionService = restrictionService;
|
||||
|
||||
GetResourceById = Get;
|
||||
GetResourceAll = GetAll;
|
||||
CreateResource = Create;
|
||||
UpdateResource = Update;
|
||||
DeleteResource = Delete;
|
||||
}
|
||||
|
||||
private RestrictionResource Get(Int32 id)
|
||||
{
|
||||
return _restrictionService.Get(id).InjectTo<RestrictionResource>();
|
||||
}
|
||||
|
||||
private List<RestrictionResource> GetAll()
|
||||
{
|
||||
return ToListResource(_restrictionService.All);
|
||||
}
|
||||
|
||||
private Int32 Create(RestrictionResource resource)
|
||||
{
|
||||
return _restrictionService.Add(resource.InjectTo<Restriction>()).Id;
|
||||
}
|
||||
|
||||
private void Update(RestrictionResource resource)
|
||||
{
|
||||
_restrictionService.Update(resource.InjectTo<Restriction>());
|
||||
}
|
||||
|
||||
private void Delete(Int32 id)
|
||||
{
|
||||
_restrictionService.Delete(id);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue