1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2025-01-21 11:02:01 +02:00
Sonarr/NzbDrone.Core/Qualities/QualitySizeRepository.cs

33 lines
896 B
C#
Raw Normal View History

2013-06-05 23:06:50 -07:00
using System;
2013-03-23 21:16:00 -07:00
using System.Linq;
2013-05-05 14:24:33 -07:00
using NzbDrone.Common.Messaging;
2013-02-26 19:19:22 -08:00
using NzbDrone.Core.Datastore;
namespace NzbDrone.Core.Qualities
{
public interface IQualitySizeRepository : IBasicRepository<QualitySize>
{
QualitySize GetByQualityId(int qualityId);
}
public class QualitySizeRepository : BasicRepository<QualitySize>, IQualitySizeRepository
{
2013-05-05 14:24:33 -07:00
public QualitySizeRepository(IDatabase database, IMessageAggregator messageAggregator)
: base(database, messageAggregator)
2013-02-26 19:19:22 -08:00
{
}
public QualitySize GetByQualityId(int qualityId)
{
2013-06-05 23:06:50 -07:00
try
{
return Query.Single(q => q.QualityId == qualityId);
}
catch (InvalidOperationException e)
{
throw new ModelNotFoundException(typeof(QualitySize), qualityId);
2013-06-05 23:06:50 -07:00
}
2013-02-26 19:19:22 -08:00
}
}
}