using System.Collections.Generic; using NzbDrone.Core.Qualities; using NzbDrone.Api.Mapping; namespace NzbDrone.Api.Qualities { public class QualityDefinitionModule : NzbDroneRestModule { private readonly IQualityDefinitionService _qualityDefinitionService; public QualityDefinitionModule(IQualityDefinitionService qualityDefinitionService) { _qualityDefinitionService = qualityDefinitionService; GetResourceAll = GetAll; GetResourceById = GetById; UpdateResource = Update; } private void Update(QualityDefinitionResource resource) { var model = resource.InjectTo(); _qualityDefinitionService.Update(model); } private QualityDefinitionResource GetById(int id) { return _qualityDefinitionService.Get((Quality)id).InjectTo(); } private List GetAll() { return ToListResource(_qualityDefinitionService.All); } } }