mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-05 02:22:31 +01:00
4188946395
file name sample uses HTTP GET instead of post
38 lines
1.0 KiB
C#
38 lines
1.0 KiB
C#
using System.Collections.Generic;
|
|
using NzbDrone.Core.Qualities;
|
|
using NzbDrone.Api.Mapping;
|
|
|
|
namespace NzbDrone.Api.Qualities
|
|
{
|
|
public class QualitySizeModule : NzbDroneRestModule<QualitySizeResource>
|
|
{
|
|
private readonly QualitySizeService _qualityTypeProvider;
|
|
|
|
public QualitySizeModule(QualitySizeService qualityTypeProvider)
|
|
{
|
|
_qualityTypeProvider = qualityTypeProvider;
|
|
|
|
GetResourceAll = GetAll;
|
|
|
|
GetResourceById = GetById;
|
|
|
|
UpdateResource = Update;
|
|
}
|
|
|
|
private void Update(QualitySizeResource resource)
|
|
{
|
|
var model = resource.InjectTo<QualitySize>();
|
|
_qualityTypeProvider.Update(model);
|
|
}
|
|
|
|
private QualitySizeResource GetById(int id)
|
|
{
|
|
return _qualityTypeProvider.Get(id).InjectTo<QualitySizeResource>();
|
|
}
|
|
|
|
private List<QualitySizeResource> GetAll()
|
|
{
|
|
return ToListResource(_qualityTypeProvider.All);
|
|
}
|
|
}
|
|
} |