Exemple #1
0
        public void Insert2()
        {
            ConnectionMongoDB connection = Main.con as ConnectionMongoDB;
            var col = connection.Database.GetCollection <Series>("Series");

            col.InsertOne(this);
        }
Exemple #2
0
        public void Delete2()
        {
            ConnectionMongoDB connection = Main.con as ConnectionMongoDB;
            var col    = connection.Database.GetCollection <Series>("Series");
            var filter = Builders <Series> .Filter.Eq("Id", ID);

            col.DeleteOne(filter);
        }
Exemple #3
0
 public void Update2()
 {
     ConnectionMongoDB connection = Main.con as ConnectionMongoDB;
     var col = connection.Database.GetCollection <User>("User");
     var res = col.ReplaceOne(
         new BsonDocument("_id", ID),
         this,
         new UpdateOptions {
         IsUpsert = true
     });
 }
Exemple #4
0
 public void Update2()
 {
     ConnectionMongoDB connection = Main.con as ConnectionMongoDB;
     var col = connection.Database.GetCollection <Series>("Series");
     //var filter = Builders<Book>.Filter.Eq("Id", ID);
     //var update = Builders<Book>.Update.
     var res = col.ReplaceOne(
         new BsonDocument("_id", ID),
         this,
         new UpdateOptions {
         IsUpsert = true
     });
 }
Exemple #5
0
        public void Insert2()
        {
            ConnectionMongoDB connection = Main.con as ConnectionMongoDB;
            var col = connection.Database.GetCollection <User>("User");

            if (Picture == null)
            {
                ImageConverter conv  = new ImageConverter();
                byte[]         bytes = (byte[])conv.ConvertTo(Properties.Resources.default_user, typeof(byte[]));
                Picture = bytes;
            }
            col.InsertOne(this);
        }