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); }
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); } }
public void Process(DataCollectorAdded @event) { var user = new DataCollector(@event); _users.Save(user); }
public void Update(DataCollector dataCollector) { var filter = Builders <DataCollector> .Filter.Eq(c => c.Id, dataCollector.Id); _collection.ReplaceOne(filter, dataCollector); }
public void Create(DataCollector dataCollector) { _collection.InsertOne(dataCollector); }
public void Save(DataCollector user) { _dataCollectorCollection.InsertOne(user); }