示例#1
0
        public async Task <UpdateResult> Update(SearchTerm searchTerm)
        {
            var filter = Builders <SearchTerm> .Filter.Eq("Text", searchTerm.Text);

            var update = Builders <SearchTerm> .Update
                         .Set("Views", searchTerm.Views);

            return(await collection.UpdateOneAsync(filter, update));
        }
示例#2
0
        public async Task <UpdateResult> Update(Answer answer)
        {
            var filter = Builders <Answer> .Filter.Eq("_id", answer.Id);

            var update = Builders <Answer> .Update
                         .Set("QuestionId", answer.QuestionId)
                         .Set("UserId", answer.UserId)
                         .Set("DateTime", answer.DateTime)
                         .Set("Text", answer.Text)
                         .Set("CleanText", answer.CleanText)
                         .Set("Tags", answer.Tags)
                         .Set("Views", answer.Views)
                         .Set("Public", answer.Public)
                         .Set("Removed", answer.Removed);

            return(await collection.UpdateOneAsync(filter, update));
        }