public static IEnumerable <NicoVideoOwner> SearchFromScreenName(string keyword) { var db = HohoemaLiteDb.GetTempLiteRepository(); { return(db.Fetch <NicoVideoOwner>(Query.Contains(nameof(NicoVideoOwner.ScreenName), keyword))); } }
public static int Delete(Expression <Func <NicoLive, bool> > expression) { var db = HohoemaLiteDb.GetTempLiteRepository(); { return(db.Delete <NicoLive>(expression)); } }
public static NicoVideoOwner Get(string id) { var db = HohoemaLiteDb.GetTempLiteRepository(); { return(db.SingleOrDefault <NicoVideoOwner>(x => x.OwnerId == id)); } }
public static bool Delete(NicoLive liveData) { var db = HohoemaLiteDb.GetTempLiteRepository(); { return(db.Delete <NicoLive>(new BsonValue(liveData.LiveId))); } }
public static bool Delete(NicoVideo video) { var db = HohoemaLiteDb.GetTempLiteRepository(); { return(db.Delete <NicoVideo>(new BsonValue(video.RawVideoId))); } }
public static int DeleteAll() { var db = HohoemaLiteDb.GetTempLiteRepository(); { return(db.Delete <NicoLive>(Query.All())); } }
public static bool Remove(int feedId) { var db = HohoemaLiteDb.GetTempLiteRepository(); var count = db.Delete <FeedVideo>(x => x.FeedId == feedId); return(count != 0); }
public static bool AddOrUpdate(NicoVideoOwner owner) { var db = HohoemaLiteDb.GetTempLiteRepository(); { return(db.Upsert(owner)); } }
public static bool AddOrUpdate(NicoVideo video) { var db = HohoemaLiteDb.GetTempLiteRepository(); { video.LastUpdated = DateTime.Now; return(db.Upsert(video)); } }
public static bool AddOrUpdate(NicoLive liveData) { var db = HohoemaLiteDb.GetTempLiteRepository(); { liveData.LastUpdated = DateTime.Now; return(db.Upsert(liveData)); } }
public static IList <FeedVideo> Get(int feedId) { var db = HohoemaLiteDb.GetTempLiteRepository(); return(db.Query <FeedVideo>() .Where(x => x.FeedId == feedId) .ToList()); }
public static bool AddOrUpdate(NicoChannelInfo info) { info.LastUpdate = DateTime.Now; var db = HohoemaLiteDb.GetTempLiteRepository(); { return(db.Upsert <NicoChannelInfo>(info)); } }
public static IEnumerable <NicoLive> SearchFromTitle(string keyword) { var db = HohoemaLiteDb.GetTempLiteRepository(); { return(db .Query <NicoLive>() .Where(Query.Contains(nameof(NicoLive.Title), keyword)) .ToList()); } }
public static NicoLive Get(string liveId) { var db = HohoemaLiteDb.GetTempLiteRepository(); { return(db .Query <NicoLive>() .Where(x => x.LiveId == liveId) .SingleOrDefault() ?? null); } }
public static NicoChannelInfo GetFromId(string id) { var db = HohoemaLiteDb.GetTempLiteRepository(); { return(db .Query <NicoChannelInfo>() .Where(x => x.Id == id) .Include(x => x.Videos) .FirstOrDefault()); } }
public static NicoVideo Get(string videoId) { var db = HohoemaLiteDb.GetTempLiteRepository(); { return(db .Query <NicoVideo>() .Include(x => x.Owner) .Where(x => x.RawVideoId == videoId) .SingleOrDefault() ?? new NicoVideo() { RawVideoId = videoId }); } }
public static IEnumerable <NicoVideo> Get(IEnumerable <string> videoIds) { var db = HohoemaLiteDb.GetTempLiteRepository(); { var q = db .Query <NicoVideo>() .Include(x => x.Owner); return(videoIds .Select(x => q.Where(y => y.RawVideoId == x) .SingleOrDefault() ?? new NicoVideo() { RawVideoId = x }) ); } }
public static void Upsert(int feedId, IEnumerable <string> videoIdList) { var db = HohoemaLiteDb.GetTempLiteRepository(); var alreadyVidoes = db.Query <FeedVideo>() .Where(x => x.FeedId == feedId) .ToList(); foreach (var videoid in videoIdList) { if (null != alreadyVidoes.SingleOrDefault(x => x.VideoId == videoid)) { db.Upsert <FeedVideo>(new FeedVideo() { FeedId = feedId, VideoId = videoid }); } } }