public Task <Guid> Handle(EditSubcriptionConfigurationCommand request, CancellationToken cancellationToken)
        {
            SubscriptionConfiguration configuration = _configurationRepository.Find(request.Id);

            if (configuration == null)
            {
                throw new Exception(typeof(SubscriptionConfiguration).Name + " not found.");
            }

            configuration.Edit(request.SubcriptionId, request.ConfigurationId, request.Enabled);
            _unitOfWork.Save();

            return(Task.FromResult(configuration.Id));
        }
Exemplo n.º 2
0
        public Task <SubcriptionConfigurationReadModel> Handle(SubscriptionConfigurationsDetailQuery request, CancellationToken cancellationToken)
        {
            SubscriptionConfiguration         subscriptionConfiguration = _subscriptionRepository.Find(request.Id);
            SubcriptionConfigurationReadModel subscriptionReadModel     = null;

            if (subscriptionConfiguration != null)
            {
                subscriptionReadModel = new SubcriptionConfigurationReadModel
                {
                    Id = subscriptionConfiguration.Id,
                    ConfigurationId = subscriptionConfiguration.ConfigurationId,
                    SubcriptionId   = subscriptionConfiguration.SubcriptionId,
                    Enabled         = subscriptionConfiguration.Enabled
                };
            }
            return(Task.FromResult(subscriptionReadModel));
        }