Example #1
0
 public void RemoveFolder(LocalLibraryModel model)
 {
     StorageApplicationPermissions.FutureAccessList.Remove(model.Token);
     LocalLibraryDb.Instance.RemoveLocalLibrary(model);
     LocalLibrary.Remove(model);
     LocalGallery.Where(it => it.LibraryId == model.Id).ToList().ForEach(it => LocalGallery.Remove(it));
 }
Example #2
0
        public void RemoveLocalLibrary(LocalLibraryModel model)
        {
            Remove <LocalLibraryModel>(model.Id);
            using var db = new LiteDatabase(DbFile);
            var galleryColumn = db.GetCollection <LocalGalleryModel>();

            galleryColumn.DeleteMany(it => it.LibraryId == model.Id);
        }
Example #3
0
        public void UpdateLocalLibrary(LocalLibraryModel model, List <LocalGalleryModel> gallery)
        {
            using var db = new LiteDatabase(DbFile);
            var galleryColumn = db.GetCollection <LocalGalleryModel>();
            var deleted       = galleryColumn.DeleteMany(it => gallery.Select(g => g.Path).All(g => g != it.Path));

            gallery.ForEach(it => it.LibraryId = model.Id);
            var news = gallery.Where(it => galleryColumn.FindOne(g => g.Path == it.Path) == null);

            galleryColumn.InsertBulk(news);
            model.Count = gallery.Count;
            db.GetCollection <LocalLibraryModel>().Update(model);
        }