示例#1
0
        public async Task <bool> UpdateAsync(MongoTable data)
        {
            var filter = Builders <MongoTable> .Filter.Eq(c => c.Id, data.Id);

            var update = Builders <MongoTable> .Update
                         .Set(c => c.Email, data.Email)
                         .Set(c => c.Name, data.Name);

            var updated = await GetCollection().UpdateOneAsync(filter, update);

            return(updated.MatchedCount > 0);
        }
示例#2
0
 internal override void SaveUpdate(ITable table, IDynamicTableObject entity)
 {
     ((MongoTable)table).MongoCollection.ReplaceOne(MongoTable.GetIdFilter(Id), entity.obj);
 }
示例#3
0
        public async Task <bool> CreateAsync(MongoTable data)
        {
            await GetCollection().InsertOneAsync(data);

            return(true);
        }