Exemplo n.º 1
0
        private async Task <RouteSegmentMarkedForDeletion> MarkRouteSegmentForDeletion(RouteSegment beforeRouteSegment)
        {
            beforeRouteSegment.MarkAsDeleted   = true;
            beforeRouteSegment.ApplicationName = _applicationSettings.ApplicationName;
            await _geoDatabase.UpdateRouteSegment(beforeRouteSegment);

            return(_routeSegmentEventFactory.CreateMarkedForDeletion(beforeRouteSegment));
        }
        public async Task Handle(RouteSegmentDeleted request, CancellationToken token)
        {
            _logger.LogInformation($"Starting {nameof(RouteSegmentDeletedHandler)}");

            var routeSegmentMarkedForDeletionEvent = _routeSegmentEventFactory.CreateMarkedForDeletion(request.RouteSegment);

            var cmdId = Guid.NewGuid();
            var routeSegmentDeletedCommand = new RouteNetworkCommand(nameof(RouteSegmentDeleted), cmdId, new List <RouteNetworkEvent> {
                routeSegmentMarkedForDeletionEvent
            }.ToArray());

            _eventStore.Insert(routeSegmentDeletedCommand);

            await Task.CompletedTask;
        }