2012-11-02 07:35:49 +00:00
|
|
|
|
using System.Linq;
|
2012-11-03 18:23:47 +00:00
|
|
|
|
using Ninject;
|
2012-11-02 07:35:49 +00:00
|
|
|
|
using NzbDrone.Api.Filters;
|
2012-11-03 18:23:47 +00:00
|
|
|
|
using NzbDrone.Core.Providers;
|
2012-11-02 07:35:49 +00:00
|
|
|
|
using ServiceStack.ServiceInterface;
|
|
|
|
|
|
2012-11-03 18:23:47 +00:00
|
|
|
|
namespace NzbDrone.Api.QualityProfiles
|
2012-11-02 07:35:49 +00:00
|
|
|
|
{
|
|
|
|
|
[ValidApiRequest]
|
|
|
|
|
public class QualityProfileService : RestServiceBase<QualityProfileRequest>
|
|
|
|
|
{
|
2012-11-03 18:23:47 +00:00
|
|
|
|
private readonly QualityProvider _qualityProvider;
|
|
|
|
|
|
|
|
|
|
[Inject]
|
|
|
|
|
public QualityProfileService(QualityProvider qualityProvider)
|
|
|
|
|
{
|
|
|
|
|
_qualityProvider = qualityProvider;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public QualityProfileService()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-11-02 07:35:49 +00:00
|
|
|
|
public override object OnGet(QualityProfileRequest request)
|
|
|
|
|
{
|
2012-11-03 18:23:47 +00:00
|
|
|
|
if (request.Id == 0)
|
|
|
|
|
{
|
|
|
|
|
var profiles = _qualityProvider.All();
|
|
|
|
|
return new { Profiles = profiles };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var profile = _qualityProvider.Get(request.Id);
|
|
|
|
|
return profile;
|
2012-11-02 07:35:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//public override object OnPost(Todo todo)
|
|
|
|
|
//{
|
|
|
|
|
// return Repository.Store(todo);
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//public override object OnPut(Todo todo)
|
|
|
|
|
//{
|
|
|
|
|
// return Repository.Store(todo);
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//public override object OnDelete(Todo request)
|
|
|
|
|
//{
|
|
|
|
|
// Repository.DeleteById(request.Id);
|
|
|
|
|
// return null;
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
}
|