Exemplo n.º 1
0
        public async Task <ActionResult <CurrentBalanceResponse> > Get()
        {
            var currentBalance = await _balanceService.GetCurrentAccountBalanceAsync();

            var response = new CurrentBalanceResponse()
            {
                CurrentAccountBalance = currentBalance
            };

            return(Ok(response));
        }
Exemplo n.º 2
0
        private async Task <bool> IsEnoughBalanceAsync(CreateTransactionModel transaction)
        {
            if (transaction.Type.IsCredit())
            {
                var currentBalance = await _balanceService.GetCurrentAccountBalanceAsync();

                if (currentBalance < transaction.Amount)
                {
                    return(false);
                }
            }

            return(true);
        }