1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00
Sonarr/NzbDrone.Api/QualityType/QualityTypeService.cs
Mark McDowall 106ea1d04b Raw-HD
New: Raw-HD (TrollHD) support added
Fixed: Parser for TrollHD releases from NzbIndex and NzbClub
#ND-115 fixed
#ND-115 comment Max size will be ignored for Raw-HD releases, since they
are always very large anyways
2013-01-09 00:15:06 -08:00

57 lines
1.7 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using AutoMapper;
using NzbDrone.Api.Filters;
using NzbDrone.Core.Providers;
using ServiceStack.ServiceInterface;
namespace NzbDrone.Api.QualityType
{
[ValidApiRequest]
public class QualityTypeService : RestServiceBase<QualityTypeModel>
{
private readonly QualityTypeProvider _qualityTypeProvider;
public QualityTypeService(QualityTypeProvider qualityTypeProvider)
{
_qualityTypeProvider = qualityTypeProvider;
}
public QualityTypeService()
{
}
public override object OnGet(QualityTypeModel request)
{
if (request.Id == 0)
{
var types = _qualityTypeProvider.All().Where(qualityType => qualityType.QualityTypeId != 0 && qualityType.QualityTypeId != 10).ToList();
return Mapper.Map<List<Core.Repository.Quality.QualityType>, List<QualityTypeModel>>(types);
}
var type = _qualityTypeProvider.Get(request.Id);
return Mapper.Map<Core.Repository.Quality.QualityType, QualityTypeModel>(type);
}
//Create
public override object OnPost(QualityTypeModel request)
{
throw new NotImplementedException();
}
//Update
public override object OnPut(QualityTypeModel request)
{
var type = Mapper.Map<QualityTypeModel, Core.Repository.Quality.QualityType>(request);
_qualityTypeProvider.Update(type);
return request;
}
public override object OnDelete(QualityTypeModel request)
{
throw new NotImplementedException();
}
}
}