|
|
@ -8,18 +8,14 @@ using NzbDrone.Api.QualityType;
|
|
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Api.QualityProfiles
|
|
|
|
namespace NzbDrone.Api.QualityProfiles
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public class QualityProfileModule : NancyModule
|
|
|
|
public class QualityProfileModule : NzbDroneApiModule
|
|
|
|
{
|
|
|
|
{
|
|
|
|
private readonly QualityProvider _qualityProvider;
|
|
|
|
private readonly QualityProvider _qualityProvider;
|
|
|
|
|
|
|
|
|
|
|
|
public QualityProfileModule(QualityProvider qualityProvider)
|
|
|
|
public QualityProfileModule(QualityProvider qualityProvider)
|
|
|
|
{
|
|
|
|
|
|
|
|
_qualityProvider = qualityProvider;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public QualityProfileModule()
|
|
|
|
|
|
|
|
: base("/QualityProfile")
|
|
|
|
: base("/QualityProfile")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
_qualityProvider = qualityProvider;
|
|
|
|
Get["/"] = x => OnGet();
|
|
|
|
Get["/"] = x => OnGet();
|
|
|
|
Get["/{Id}"] = x => OnGet((int)x.Id);
|
|
|
|
Get["/{Id}"] = x => OnGet((int)x.Id);
|
|
|
|
Put["/"] = x => OnPut();
|
|
|
|
Put["/"] = x => OnPut();
|
|
|
@ -44,7 +40,7 @@ namespace NzbDrone.Api.QualityProfiles
|
|
|
|
var profile = Mapper.Map<QualityProfileModel, QualityProfile>(request);
|
|
|
|
var profile = Mapper.Map<QualityProfileModel, QualityProfile>(request);
|
|
|
|
request.Id = _qualityProvider.Add(profile);
|
|
|
|
request.Id = _qualityProvider.Add(profile);
|
|
|
|
|
|
|
|
|
|
|
|
return request.AsResponse();
|
|
|
|
return request.AsResponse();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//Update
|
|
|
|
//Update
|
|
|
@ -54,7 +50,7 @@ namespace NzbDrone.Api.QualityProfiles
|
|
|
|
var profile = Mapper.Map<QualityProfileModel, QualityProfile>(request);
|
|
|
|
var profile = Mapper.Map<QualityProfileModel, QualityProfile>(request);
|
|
|
|
_qualityProvider.Update(profile);
|
|
|
|
_qualityProvider.Update(profile);
|
|
|
|
|
|
|
|
|
|
|
|
return request.AsResponse();
|
|
|
|
return request.AsResponse();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private Response OnDelete(int id)
|
|
|
|
private Response OnDelete(int id)
|
|
|
|