public void Insert2() { ConnectionMongoDB connection = Main.con as ConnectionMongoDB; var col = connection.Database.GetCollection <Series>("Series"); col.InsertOne(this); }
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); }
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 }); }
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 }); }
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); }