1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-14 11:23:42 +02:00
Sonarr/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;
}
}
}