updated seriesrepo to use the new syntax.

This commit is contained in:
kay.one
2013-03-23 21:25:16 -07:00
parent 1a4f3fad25
commit b04fb32f77
4 changed files with 42 additions and 34 deletions
+5 -7
View File
@@ -1,8 +1,6 @@
using System.Collections.Generic;
using System.Data;
using System.Linq;
using NzbDrone.Core.Datastore;
using ServiceStack.OrmLite;
namespace NzbDrone.Core.Tv
{
@@ -24,27 +22,27 @@ namespace NzbDrone.Core.Tv
public bool SeriesPathExists(string path)
{
return Database.Exists<Series>("WHERE Path = {0}", path);
return Any(c => c.Path == path);
}
public List<Series> Search(string title)
{
return Database.Select<Series>(s => s.Title.Contains(title));
return Where(s => s.Title.Contains(title));
}
public Series GetByTitle(string cleanTitle)
{
return Database.Select<Series>(s => s.CleanTitle.Equals(cleanTitle)).SingleOrDefault();
return SingleOrDefault(s => s.CleanTitle.Equals(cleanTitle));
}
public Series FindByTvdbId(int tvdbId)
{
return Database.Select<Series>(s => s.TvDbId.Equals(tvdbId)).SingleOrDefault();
return SingleOrDefault(s => s.TvDbId.Equals(tvdbId));
}
public void SetSeriesType(int seriesId, SeriesTypes seriesType)
{
Database.UpdateOnly(new Series { SeriesType = seriesType }, s => s.SeriesType, s => s.Id == seriesId);
UpdateFields(new Series { Id = seriesId, SeriesType = seriesType }, s => s.SeriesType);
}
}
}