コード例 #1
0
        public void InsertNewManga(Manga manga)
        {
            var query = _db.GetCollection <Manga>("NewManga");

            query.Insert(manga);
            MangaEvent?.Invoke(manga, MangaEnum.InsertNewManga);
        }
コード例 #2
0
        public void DeleteNewManga(Manga manga)
        {
            var query = _db.GetCollection <Manga>("NewManga");

            query.Delete(manga.MangaId);
            MangaEvent?.Invoke(manga, MangaEnum.DeleteNewManga);
        }
コード例 #3
0
        public IEnumerable <Manga> GetMangasFrom(string site)
        {
            var query = _db.GetCollection <Manga>("Manga").Find(s => s.Site == site);

            MangaEvent?.Invoke(query, MangaEnum.Get);
            return(query);
        }
コード例 #4
0
        public void InsertHistory(Manga manga)
        {
            var query = _db.GetCollection <Manga>("History");

            query.Insert(manga);
            MangaEvent?.Invoke(manga, MangaEnum.InsertHistory);
        }
コード例 #5
0
        public IEnumerable <Manga> GetAllMangas()
        {
            var query = _db.GetCollection <Manga>("Manga").FindAll();

            MangaEvent?.Invoke(query, MangaEnum.Get);
            return(query);
        }
コード例 #6
0
        public void DeleteHistory(Manga manga)
        {
            var query = _db.GetCollection <Manga>("History");

            query.Delete(manga.MangaId);
            MangaEvent?.Invoke(manga, MangaEnum.DeleteHistory);
        }
コード例 #7
0
        public IOrderedEnumerable <Manga> GetAllNewMangas()
        {
            var query   = _db.GetCollection <Manga>("NewManga").FindAll();
            var ordered = query.OrderBy(m => m.Added);

            MangaEvent?.Invoke(ordered, MangaEnum.New);
            return(ordered);
        }
コード例 #8
0
        public IOrderedEnumerable <Manga> GetHistory()
        {
            var query   = _db.GetCollection <Manga>("History").FindAll();
            var ordered = query.OrderByDescending(m => m.Added);

            MangaEvent?.Invoke(ordered, MangaEnum.GetHistory);
            return(ordered);
        }
コード例 #9
0
        public void Update(Manga manga, bool history = false)
        {
            var query = _db.GetCollection <Manga>("Manga");

            query.Update(manga);
            if (history)
            {
                return;
            }
            MangaEvent?.Invoke(manga, MangaEnum.Update);
        }
コード例 #10
0
        public void UpdateMangaTrans(List <Manga> manga, bool history = false)
        {
            var query = _db.GetCollection <Manga>("Manga");

            using (var trans1 = _db.BeginTrans()) {
                query.Update(manga);
                trans1.Commit();
            }
            if (history)
            {
                return;
            }
            MangaEvent?.Invoke(manga, MangaEnum.Update);
        }