コード例 #1
0
        public async Task <SearchTransactionResponse> GetAccountTransactionsAsync(ClaimsPrincipal claimsPrincipal)
        {
            SearchTransactionResponse response = new SearchTransactionResponse();

            try
            {
                var user = await this.userRepository.GetByIdAsync(claimsPrincipal.GetUserId());

                if (user.Account.IsNotNull())
                {
                    response.Transactions = await this.transactionRepository.GetAccountTransactionsAsync(user.Account);
                }
                else
                {
                    response.Errors.Add(new Error()
                    {
                        Code = ((int)ErrorCodes.NotFound).ToString(), Message = $"Account was not found"
                    });
                }
            }
            catch (Exception exc)
            {
                response.IsSuccessful = false;
                response.Errors.Add(new Error()
                {
                    Code = ((int)ErrorCodes.Unknown).ToString(), Message = "There was a problem. Please try again later"
                });
            }
            return(response);
        }
コード例 #2
0
        public SearchTransactionResponse SearchTransactionByUser(Request req)
        {
            SearchTransactionResponse res = new SearchTransactionResponse();

            using (DATransaction da = new DATransaction())
            {
                res.Transactions = da.SearchTransactionByUser(User.Id);
            }
            res.IsSuccessful = true;
            return(res);
        }
コード例 #3
0
        public async Task <SearchTransactionResponse> GetBusinessTransactionsAsync(ClaimsPrincipal claimsPrincipal)
        {
            SearchTransactionResponse response = new SearchTransactionResponse();

            try
            {
                response.Transactions = await this.transactionRepository.GetBusinessesTransactionsAsync(claimsPrincipal.GetUserId());
            }
            catch (Exception)
            {
                response.IsSuccessful = false;
                response.Errors.Add(new Error()
                {
                    Code = ((int)ErrorCodes.Unknown).ToString(), Message = "There was a problem. Please try again later"
                });
            }
            return(response);
        }