コード例 #1
0
        public Task <Unit> Handle(RemoveRestaurantCommand message, CancellationToken cancellationToken)
        {
            if (!message.IsValid())
            {
                NotifyValidationErrors(message);
                return(Unit.Task);
            }

            _restaurantRepository.Remove(message.Id);

            if (Commit())
            {
                Bus.RaiseEvent(new RestaurantRemovedEvent(message.Id));
            }

            return(Unit.Task);
        }
コード例 #2
0
        public void Remove(Guid id)
        {
            var removeCommand = new RemoveRestaurantCommand(id);

            Bus.SendCommand(removeCommand);
        }