public void Process(DataCollectorVillageChanged @event)
        {
            var dataCollector = _dataCollectors.GetById(@event.DataCollectorId);

            dataCollector.Village = @event.Village;
            _dataCollectors.Update(dataCollector);
        }
        public void Process(DataCollectorVillageChanged @event, EventSourceId dataCollectorId)
        {
            var dataCollector = _dataCollectors.GetById(dataCollectorId.Value);

            dataCollector.Village = @event.Village;

            _dataCollectors.Update(dataCollector);
        }
示例#3
0
        public void Process(DataCollectorVillageChanged @event, EventSourceId dataCollectorId)
        {
            var village = _repositoryForVillage.Query.FirstOrDefault(_ => _.Name == @event.Village);

            if (village == null)
            {
                var dataCollector = _dataCollectors.GetById(dataCollectorId);
                var district      = _repositoryForDistrict.Query.FirstOrDefault(_ => _.Name == dataCollector.District);
                _repositoryForVillage.Insert(new Village()
                {
                    Id         = Guid.NewGuid(),
                    Name       = @event.Village,
                    DistrictId = district.Id
                });
            }
        }
 public void Process(DataCollectorVillageChanged @event)
 {
     var updateRes = _dataCollectors.Update(d => d.Id == @event.DataCollectorId,
                                            Builders <DataCollector> .Update.Set(d => d.Village, @event.Village ?? "Unknown"));
 }
示例#5
0
 public void Process(DataCollectorVillageChanged @event)
 {
     _dataCollectors.Update(d => d.Id == (DataCollectorId)@event.DataCollectorId,
                            Builders <DataCollector> .Update.Set(d => d.Village, @event.Village));
 }
示例#6
0
 public void Process(DataCollectorVillageChanged @event)
 {
     var res = _dataCollectors.UpdateOne(
         Builders <DataCollector> .Filter.Where(d => d.DataCollectorId == @event.DataCollectorId),
         Builders <DataCollector> .Update.Set(d => d.Village, @event.Village));
 }
示例#7
0
 public void Process(DataCollectorVillageChanged @event)
 {
     _dataCollectors.Update(Builders <DataCollector> .Filter.Where(d => d.Id == @event.DataCollectorId),
                            Builders <DataCollector> .Update.Set(d => d.Village, @event.Village ?? "Unknown"));
 }