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

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

            query.Delete(manga.MangaId);
            MangaEvent?.Invoke(manga, MangaEnum.DeleteNewManga);
        }
Example #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);
        }
Example #4
0
        public void InsertHistory(Manga manga)
        {
            var query = _db.GetCollection <Manga>("History");

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

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

            query.Delete(manga.MangaId);
            MangaEvent?.Invoke(manga, MangaEnum.DeleteHistory);
        }
Example #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);
        }
Example #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);
        }
Example #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);
        }
Example #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);
        }