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