1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00
Sonarr/NzbDrone.Api/Qualities/QualitySizeModule.cs

38 lines
1.0 KiB
C#
Raw Normal View History

using System.Collections.Generic;
2013-02-27 06:19:22 +03:00
using NzbDrone.Core.Qualities;
2013-05-31 03:12:20 +03:00
using NzbDrone.Api.Mapping;
2013-05-20 03:30:02 +03:00
namespace NzbDrone.Api.Qualities
{
2013-05-31 03:12:20 +03:00
public class QualitySizeModule : NzbDroneRestModule<QualitySizeResource>
{
2013-02-27 06:19:22 +03:00
private readonly QualitySizeService _qualityTypeProvider;
public QualitySizeModule(QualitySizeService qualityTypeProvider)
{
_qualityTypeProvider = qualityTypeProvider;
2013-05-31 03:12:20 +03:00
GetResourceAll = GetAll;
2013-05-31 03:12:20 +03:00
GetResourceById = GetById;
2013-05-31 03:12:20 +03:00
UpdateResource = Update;
}
private void Update(QualitySizeResource resource)
{
2013-05-31 03:12:20 +03:00
var model = resource.InjectTo<QualitySize>();
_qualityTypeProvider.Update(model);
}
2013-05-31 03:12:20 +03:00
private QualitySizeResource GetById(int id)
{
return _qualityTypeProvider.Get(id).InjectTo<QualitySizeResource>();
2013-05-31 03:12:20 +03:00
}
2013-05-31 03:12:20 +03:00
private List<QualitySizeResource> GetAll()
{
return ToListResource(_qualityTypeProvider.All);
}
}
}