public void InsertNewManga(Manga manga) { var query = _db.GetCollection <Manga>("NewManga"); query.Insert(manga); MangaEvent?.Invoke(manga, MangaEnum.InsertNewManga); }
public void DeleteNewManga(Manga manga) { var query = _db.GetCollection <Manga>("NewManga"); query.Delete(manga.MangaId); MangaEvent?.Invoke(manga, MangaEnum.DeleteNewManga); }
public IEnumerable <Manga> GetMangasFrom(string site) { var query = _db.GetCollection <Manga>("Manga").Find(s => s.Site == site); MangaEvent?.Invoke(query, MangaEnum.Get); return(query); }
public void InsertHistory(Manga manga) { var query = _db.GetCollection <Manga>("History"); query.Insert(manga); MangaEvent?.Invoke(manga, MangaEnum.InsertHistory); }
public IEnumerable <Manga> GetAllMangas() { var query = _db.GetCollection <Manga>("Manga").FindAll(); MangaEvent?.Invoke(query, MangaEnum.Get); return(query); }
public void DeleteHistory(Manga manga) { var query = _db.GetCollection <Manga>("History"); query.Delete(manga.MangaId); MangaEvent?.Invoke(manga, MangaEnum.DeleteHistory); }
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); }
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); }
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); }
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); }