Exemple #1
0
        public async Task <IActionResult> AppendCollection([FromForm] CollectionViewModel model)
        {
            var collection = new Collection
            {
                Name            = model.Name,
                DisplayName     = model.DisplayName,
                DisplayOrder    = model.DisplayOrder,
                TitlePath       = model.TitlePath,
                PreviewTemplate = model.PreviewTemplate,
                Schema          = model.Schema,
                Procedures      = model.Procedures ?? new ProcedureInfo[0]
            };

            await _settingsService.AddAsync(collection);

            return(RedirectToAction(nameof(Collections)));
        }
        public async Task Consume(ConsumeContext <SubscriptionAdded> context)
        {
            var message = context.Message;

            var brokerId = message.SubscriptionId.ToString();

            // TODO: must be extracted to service layer
            var account = new AccountAddModel();

            account.BrokerId = brokerId;
            account.Name     = "Fee Account";
            var newAccount = await _accountsClient.Account.AddAsync(account);

            var settings = new Settings();

            settings.BrokerId     = message.SubscriptionId.ToString();
            settings.FeeAccountId = newAccount.Id;
            settings.FeeWalletId  = newAccount.Wallets.Single().Id;

            await _settingsService.AddAsync(settings);

            _logger.LogInformation("SubscriptionAdded command has been processed {@context}", message);
        }