You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
716 B
23 lines
716 B
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Marr.Data.QGen;
|
|
|
|
namespace NzbDrone.Core.Movies
|
|
{
|
|
public static class QueryExtensions
|
|
{
|
|
public static Movie FirstWithYear(this SortBuilder<Movie> query, int? year)
|
|
{
|
|
return year.HasValue ? query.FirstOrDefault(movie => movie.Year == year || movie.SecondaryYear == year) : query.FirstOrDefault();
|
|
}
|
|
}
|
|
|
|
public static class EnumerableExtensions
|
|
{
|
|
public static Movie FirstWithYear(this IEnumerable<Movie> query, int? year)
|
|
{
|
|
return year.HasValue ? query.FirstOrDefault(movie => movie.Year == year || movie.SecondaryYear == year) : query.FirstOrDefault();
|
|
}
|
|
}
|
|
}
|