public bool UpdateOrInsertStorage(QRCodeStorage storage) { BsonDocument bd = new BsonDocument { { "$set", BsonExtensionMethods.ToBsonDocument(storage) } }; UpdateResult ur = paySysDB.GetCollection <QRCodeStorage>(Key.qrStorage.ToString()).UpdateOne(item => item.name == storage.name, new UpdateDocument(bd), new UpdateOptions() { IsUpsert = true }); return(ur.ModifiedCount == 1); }
public bool InsertStorage(QRCodeStorage storage) { paySysDB.GetCollection <QRCodeStorage>(Key.qrStorage.ToString()).InsertOne(storage); return(true); }