Пример #1
0
        public async Task Insert(Build item)
        {
            item.Id = Guid.NewGuid();
            item.RegenerateCachedProperties();

            await _buildCollection.InsertOneAsync(item);
        }
Пример #2
0
        public async Task Update(Build item)
        {
            Build old = await SelectById(item.Id);

            item.Added    = old.Added;
            item.Modified = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Utc);
            item.RegenerateCachedProperties();

            await _buildCollection.ReplaceOneAsync(Builders <Build> .Filter.Eq(b => b.Id, item.Id), item);
        }