Example #1
0
        public void Execute(RemoveFilterCommand command)
        {
            var filter = command.Filter;

            if (_stateService.GetSelectedFilter() == filter)
            {
                _stateService.SetSelectedFilter(null);
            }

            _repository.Remove(filter);

            _eventBus.Raise(new FilterRemovedEvent(filter));
        }
        public void Execute(SelectFilterTreeNodeCommand command)
        {
            var oldFilter = _service.GetSelectedFilter();

            if (oldFilter != null)
            {
                _repository.Remove(oldFilter);

                _eventBus.Raise(new FilterRemovedEvent(oldFilter));
            }

            var newFilter = command.Entity.CreateFilter();

            _service.SetSelectedFilter(newFilter);

            _repository.Add(newFilter);

            _eventBus.Raise(new FilterAddedEvent(newFilter));
        }