public static List <SearchHistory> Get(int start, int count) { var db = HohoemaLiteDb.GetLocalLiteRepository(); { return(db.Query <SearchHistory>().Skip(start).Limit(count).ToList()); } }
public static bool Remove(string keyword, SearchTarget target) { var db = HohoemaLiteDb.GetLocalLiteRepository(); { return(db.Delete <SearchHistory>(x => x.Keyword == keyword && x.Target == target) > 0); } }
public static SearchHistory Searched(string keyword, SearchTarget target) { var db = HohoemaLiteDb.GetLocalLiteRepository(); { var searchHistory = db.SingleOrDefault <SearchHistory>(x => x.Keyword == keyword && x.Target == target); if (searchHistory == null) { searchHistory = new SearchHistory { Keyword = keyword, Target = target, LastUpdated = DateTime.Now, SearchCount = 1 }; } else { searchHistory.LastUpdated = DateTime.Now; searchHistory.SearchCount++; } db.Upsert <SearchHistory>(searchHistory); return(searchHistory); } }
public static void Clear() { var db = HohoemaLiteDb.GetLocalLiteRepository(); { db.Delete <SearchHistory>(Query.All()); } }
public static bool Remove(string videoId) { var db = HohoemaLiteDb.GetLocalLiteRepository(); { return(db.Delete <NicoVideoComment>(x => x.VideoId == videoId) > 0); } }
public static NicoVideoComment Get(string videoId) { var db = HohoemaLiteDb.GetLocalLiteRepository(); { return(db.SingleOrDefault <NicoVideoComment>(x => x.VideoId == videoId)); } }
public static VideoPlayHistory Get(string videoId) { var db = HohoemaLiteDb.GetLocalLiteRepository(); { return(db.SingleOrDefault <VideoPlayHistory>(x => x.VideoId == videoId)); } }
public static bool IsVideoPlayed(string videoId) { var db = HohoemaLiteDb.GetLocalLiteRepository(); { return(db.SingleOrDefault <VideoPlayHistory>(x => x.VideoId == videoId)?.PlayCount > 0); } }
public static List <SearchHistory> GetAll() { var db = HohoemaLiteDb.GetLocalLiteRepository(); { return(db.Query <SearchHistory>().ToList()); } }
public static void ClearAllHistories() { var db = HohoemaLiteDb.GetLocalLiteRepository(); { db.Delete <VideoPlayHistory>(Query.All()); } }
public static List <Feed> GetAll() { var db = HohoemaLiteDb.GetLocalLiteRepository(); return(db.Query <Feed>() .Include(x => x.Sources) .ToList()); }
public static SearchTarget?LastSearchedTarget(string keyword) { var db = HohoemaLiteDb.GetLocalLiteRepository(); { var searchHistory = db.Fetch <SearchHistory>(x => x.Keyword == keyword).OrderByDescending(x => x.LastUpdated).FirstOrDefault(); return(searchHistory?.Target); } }
public static int Count() { var db = HohoemaLiteDb.GetLocalLiteRepository(); { return(db.Query <SearchHistory>() .Count()); } }
public static Feed Get(int id) { var db = HohoemaLiteDb.GetLocalLiteRepository(); return(db.Query <Feed>() .Include(x => x.Sources) .Where(x => x.Id == id) .SingleOrDefault()); }
public static bool AddOrUpdate(Feed feedGroup) { var db = HohoemaLiteDb.GetLocalLiteRepository(); // 未登録のBookmarkをDbに登録 var notExistItems = feedGroup.Sources .Where(x => null == db.SingleOrDefault <Bookmark>(y => x.BookmarkType == y.BookmarkType && x.Content == y.Content)); db.Upsert(notExistItems); return(db.Upsert(feedGroup)); }
public static bool Add(Bookmark bookmark) { // 重複チェック必要 var db = HohoemaLiteDb.GetLocalLiteRepository(); var already = db.SingleOrDefault <Bookmark>(x => x.Content == bookmark.Content && x.BookmarkType == bookmark.BookmarkType); if (already != null) { bookmark.Id = already.Id; return(false); } db.Insert(bookmark); return(true); }
public static void AddOrUpdate(string videoId, IEnumerable <Chat> chatItems) { var db = HohoemaLiteDb.GetLocalLiteRepository(); { var comment = db.SingleOrDefault <NicoVideoComment>(x => x.VideoId == videoId); if (comment == null) { comment = new NicoVideoComment { VideoId = videoId, }; } comment.ChatItems = chatItems.ToList(); db.Upsert <NicoVideoComment>(comment); } }
public static void VideoPlayed(string videoId) { var db = HohoemaLiteDb.GetLocalLiteRepository(); { var history = db.SingleOrDefault <VideoPlayHistory>(x => x.VideoId == videoId); if (history != null) { history.PlayCount++; } else { history = new VideoPlayHistory { VideoId = videoId, PlayCount = 1, LastPlayed = DateTime.Now }; } db.Upsert(history); } }
public static bool Remove(Bookmark bookmark) { var db = HohoemaLiteDb.GetLocalLiteRepository(); return(db.Delete <Bookmark>(bookmark.Id)); }
public static bool Delete(Feed feedGroup) { var db = HohoemaLiteDb.GetLocalLiteRepository(); return(db.Delete <Feed>(feedGroup.Id)); }
public static List <Bookmark> GetAll(BookmarkType bookmarkType) { var db = HohoemaLiteDb.GetLocalLiteRepository(); return(db.Fetch <Bookmark>(x => x.BookmarkType == bookmarkType)); }
public static Bookmark Get(BookmarkType bookmarkType, string content) { var db = HohoemaLiteDb.GetLocalLiteRepository(); return(db.SingleOrDefault <Bookmark>(x => x.BookmarkType == bookmarkType && x.Content == content)); }
public static List <Bookmark> GetAll() { var db = HohoemaLiteDb.GetLocalLiteRepository(); return(db.Fetch <Bookmark>()); }