예제 #1
0
        public async Task <bool> Update(MsgDM data)
        {
            var filter = Builders <MsgDM> .Filter.Eq(x => x.Id, data.Id);

            var update = Builders <MsgDM> .Update.Set(x => x.Title, data.Title).Set(x => x.Content, data.Content);

            var result = await _collection.UpdateOneAsync(Builders <MsgDM> .Filter.Eq(x => x.Id, data.Id), update);

            return(result.ModifiedCount == 1);
        }
예제 #2
0
        public async Task <string> Insert(MsgDM data)
        {
            await _collection.InsertOneAsync(data);

            return(data.Id.ToString());
        }