1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-05 02:22:31 +01:00
Radarr/NzbDrone.Api/Resolvers/QualitiesToAllowedResolver.cs
2013-02-26 19:19:47 -08:00

28 lines
762 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AutoMapper;
using NzbDrone.Api.QualityProfiles;
using NzbDrone.Core.Qualities;
namespace NzbDrone.Api.Resolvers
{
public class QualitiesToAllowedResolver : ValueResolver<List<QualityProfileType>, List<Quality>>
{
protected override List<Quality> ResolveCore(List<QualityProfileType> source)
{
var ids = source.Where(s => s.Allowed).Select(s => s.Id).ToList();
var qualityTypes = new List<Quality>();
ids.ForEach(id =>
{
qualityTypes.Add(Quality.FindById(id));
});
return qualityTypes;
}
}
}