1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-23 02:05:27 +02:00
Sonarr/NzbDrone.Core/Qualities/QualitySizeRepository.cs

35 lines
927 B
C#
Raw Normal View History

2013-06-06 09:06:50 +03:00
using System;
2013-03-24 07:16:00 +03:00
using System.Linq;
2013-02-27 06:19:22 +03:00
using NzbDrone.Core.Datastore;
2013-09-11 09:33:47 +03:00
using NzbDrone.Core.Messaging;
using NzbDrone.Core.Messaging.Events;
2013-09-11 09:33:47 +03:00
2013-02-27 06:19:22 +03:00
namespace NzbDrone.Core.Qualities
{
public interface IQualitySizeRepository : IBasicRepository<QualitySize>
{
QualitySize GetByQualityId(int qualityId);
}
public class QualitySizeRepository : BasicRepository<QualitySize>, IQualitySizeRepository
{
public QualitySizeRepository(IDatabase database, IEventAggregator eventAggregator)
: base(database, eventAggregator)
2013-02-27 06:19:22 +03:00
{
}
public QualitySize GetByQualityId(int qualityId)
{
2013-06-06 09:06:50 +03:00
try
{
return Query.Single(q => q.QualityId == qualityId);
}
catch (InvalidOperationException e)
{
throw new ModelNotFoundException(typeof(QualitySize), qualityId);
2013-06-06 09:06:50 +03:00
}
2013-02-27 06:19:22 +03:00
}
}
}