Exemple #1
0
        public async Task <IActionResult> GetUsers()
        {
            var getAllUsers = new GetAllUsers();

            var result = await _queryProcessor.ExecuteQueryAsync <GetAllUsers, IEnumerable <UserDtoItem> >(getAllUsers);

            return(Ok(result));
        }
        public async Task <IActionResult> GetAllAccountsFromUser(Guid walletId)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            var result = await _queryProcessor.ExecuteQueryAsync <GetAllAccountsFromUser, IEnumerable <AccountFromWalletDto> >(new GetAllAccountsFromUser(walletId));

            return(Ok(result));
        }
Exemple #3
0
        public ApplicationSettingsViewModel([NotNull] IQueryProcessor queryProcessor, [NotNull] IDelayService delayService)
        {
            Guard.NotNull(queryProcessor, nameof(queryProcessor));
            Guard.NotNull(delayService, nameof(delayService));

            SearchProviderNames       = new ObservableCollection <string>();
            getSearchProvidersCommand = new CapturingExceptionAsyncCommand(async() =>
            {
                if (entity?.DelayExecution.Enabled ?? true)
                {
                    await delayService.DelayAsync();
                }

                var result = await queryProcessor.ExecuteQueryAsync(GetAllSearchProvidersQuery.Instance);

                var tmp = SearchProviderName;

                SearchProviderNames.Clear();

                foreach (var item in result.OrderBy(x => x.Priority))
                {
                    SearchProviderNames.Add(item.Name);
                }

                if (SearchProviderNames.Contains(tmp))
                {
                    SearchProviderName = tmp;
                    return;
                }

                SearchProviderName = result
                                     .OrderBy(x => x.Priority)
                                     .FirstOrDefault()
                                     ?.Name;
            });

            VersionControlProviderNames       = new ObservableCollection <string>();
            getVersionControlProvidersCommand = new CapturingExceptionAsyncCommand(async() =>
            {
                if (entity?.DelayExecution.Enabled ?? true)
                {
                    await delayService.DelayAsync();
                }

                var result = await queryProcessor.ExecuteQueryAsync(GetAllVersionControlProvidersQuery.Instance);

                var tmp = VersionControlProviderName;
                VersionControlProviderNames.Clear();

                foreach (var item in result.OrderBy(x => x.Priority))
                {
                    VersionControlProviderNames.Add(item.Name);
                }

                if (VersionControlProviderNames.Contains(tmp))
                {
                    VersionControlProviderName = tmp;
                    return;
                }

                VersionControlProviderName = result
                                             .OrderBy(x => x.Priority)
                                             .FirstOrDefault()
                                             ?.Name;
            });
        }