using System; using System.Collections.Generic; using System.Linq; using System.Web; using MongoDB.Driver; using MongoDB.Driver.Builders; namespace NzbDrone.Services.Api.DailySeries { public class DailySeriesProvider { private readonly MongoDatabase _mongoDb; public DailySeriesProvider(MongoDatabase mongoDb) { _mongoDb = mongoDb; } public DailySeriesProvider() { } public List All() { return _mongoDb.GetCollection(DailySeriesModel.CollectionName).FindAll().ToList(); } public List Public() { var query = Query.EQ(d => d.Public, true); return _mongoDb.GetCollection(DailySeriesModel.CollectionName).Find(query).ToList(); } public Boolean IsDaily(int seriesId) { var query = Query.EQ(d => d.Id, seriesId); return _mongoDb.GetCollection(DailySeriesModel.CollectionName).Count(query) > 0; } } }