1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00
Sonarr/NzbDrone.Api/Resolvers/QualitiesToAllowedResolver.cs

28 lines
756 B
C#
Raw Normal View History

2012-12-03 06:08:26 +03:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AutoMapper;
2013-05-20 03:30:02 +03:00
using NzbDrone.Api.Qualities;
2013-02-27 06:19:22 +03:00
using NzbDrone.Core.Qualities;
2012-12-03 06:08:26 +03:00
namespace NzbDrone.Api.Resolvers
{
2013-02-27 06:19:22 +03:00
public class QualitiesToAllowedResolver : ValueResolver<List<QualityProfileType>, List<Quality>>
2012-12-03 06:08:26 +03:00
{
2013-02-27 06:19:22 +03:00
protected override List<Quality> ResolveCore(List<QualityProfileType> source)
2012-12-03 06:08:26 +03:00
{
var ids = source.Where(s => s.Allowed).Select(s => s.Id).ToList();
2013-02-27 06:19:22 +03:00
var qualityTypes = new List<Quality>();
2012-12-03 06:08:26 +03:00
ids.ForEach(id =>
{
2013-02-27 06:19:22 +03:00
qualityTypes.Add(Quality.FindById(id));
2012-12-03 06:08:26 +03:00
});
return qualityTypes;
}
}
}