示例#1
0
文件: Users.cs 项目: roarfred/cbs
        public DataCollector GetDataCollectorById(Guid id)
        {
            var user = _dataCollectorCollection.Find(c => c.Id == id).SingleOrDefault();

            if (user == null)
            {
                user = new DataCollector {
                    Id = id
                };
                _dataCollectorCollection.InsertOne(user);
            }

            return(user);
        }
示例#2
0
        public void Process(DataCollectorRegistered @event)
        {
            var dataCollector = _dataCollectors.GetById(@event.Id);

            if (dataCollector == null)
            {
                dataCollector = new DataCollector {
                    Id = @event.Id
                };
                _dataCollectors.Create(dataCollector);
            }
            else
            {
                //TODO: Update volunteer properties
                _dataCollectors.Update(dataCollector);
            }
        }
示例#3
0
        public void Process(DataCollectorAdded @event)
        {
            var user = new DataCollector(@event);

            _users.Save(user);
        }
示例#4
0
        public void Update(DataCollector dataCollector)
        {
            var filter = Builders <DataCollector> .Filter.Eq(c => c.Id, dataCollector.Id);

            _collection.ReplaceOne(filter, dataCollector);
        }
示例#5
0
 public void Create(DataCollector dataCollector)
 {
     _collection.InsertOne(dataCollector);
 }
示例#6
0
文件: Users.cs 项目: roarfred/cbs
 public void Save(DataCollector user)
 {
     _dataCollectorCollection.InsertOne(user);
 }