Exemple #1
0
        public void Add(Models.TextContent content)
        {
            content.StoreFiles();

            ((IPersistable)content).OnSaving();
            var bucket = content.GetRepository().GetClient();

            //bucket.Store(StoreMode.Set, "Schema." + content.UUID, content.ToJson());
            bucket.ExecuteStore(StoreMode.Set, content.UUID, content.ToJson(), PersistTo.One);
            ((IPersistable)content).OnSaved();
        }
Exemple #2
0
        public void Update(Models.TextContent @new, Models.TextContent old)
        {
            //if (@new["_id"] == null && old["_id"] != null)
            //{
            //    @new["_id"] = old["_id"];
            //}

            @new.StoreFiles();
            ((IPersistable)@new).OnSaving();
            var bucket = old.GetRepository().GetClient();

            bucket.ExecuteStore(StoreMode.Replace, old.UUID, @new.ToJson(), PersistTo.One);
            ((IPersistable)@new).OnSaved();
        }