Exemple #1
0
        public async Task <DeleteIqAccountResult> ExecuteCommandAsync(IqOptionAggregate aggregate,
                                                                      DeleteIqAccountCommand command,
                                                                      CancellationToken cancellationToken)
        {
            var dto = await _iqAccountRepository.FirstOrDefaultAsync(x => x.Id == command.IqAccountId);

            if (dto != null)
            {
                await _iqAccountRepository.DeleteAsync(dto);

                return(new DeleteIqAccountResult(true));
            }

            return(new DeleteIqAccountResult(false));
        }
Exemple #2
0
        public async Task <CommandResult> ExecuteCommandAsync(IqAggregate aggregate,
                                                              DeleteIqAccountCommand command,
                                                              CancellationToken cancellationToken)
        {
            var dto = await _iqAccountRepository.FirstOrDefaultAsync(x => x.Id == command.IqAccountId);

            if (dto != null)
            {
                await _iqAccountRepository.DeleteAsync(dto);

                //publish to bus
                await _activeAccountBusSender.SendAsync(new SetActiveAccountStatusItem(false, dto.IqOptionUserId), cancellationToken);

                return(SuccessResult.New);
            }

            return(NotSuccessResult.New);
        }