Sonarr/NzbDrone.Api/QualityProfiles/QualityProfileService.cs

52 lines
1.3 KiB
C#
Raw Normal View History

2012-11-02 07:35:49 +00:00
using System.Linq;
using Ninject;
2012-11-02 07:35:49 +00:00
using NzbDrone.Api.Filters;
using NzbDrone.Core.Providers;
2012-11-02 07:35:49 +00:00
using ServiceStack.ServiceInterface;
namespace NzbDrone.Api.QualityProfiles
2012-11-02 07:35:49 +00:00
{
[ValidApiRequest]
public class QualityProfileService : RestServiceBase<QualityProfileRequest>
{
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)
{
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;
//}
}
}