public async Task <bool> IsExistTransactionAsync(BankTransaction bankTransaction)
 {
     try
     {
         BankTransaction b = await GetTransactionAsync(bankTransaction);
     }
     catch (NotFoundException)
     {
         return(false);
     }
     return(true);
 }
 public async Task <BankTransaction> GetTransactionAsync(BankTransaction bankTransaction)
 {
     try
     {
         return(await db.BankTransactions
                .FirstAsync(x => x.BankID == bankTransaction.BankID &&
                            x.BankTransactionID == bankTransaction.BankTransactionID));
     }
     catch (System.Exception)
     {
         throw new NotFoundException();
     }
 }
        public async Task <bool> UpdateTransactionAsync(BankTransaction bankTransaction)
        {
            if (!(await IsExistTransactionAsync(bankTransaction)))
            {
                throw new NotFoundException();
            }

            try
            {
                db.BankTransactions.Update(bankTransaction);
                return(true);
            }
            catch (System.Exception)
            {
                throw;
            }
        }
        public async Task <bool> InsertTransactionAsync(BankTransaction bankTransaction)
        {
            if (await IsExistTransactionAsync(bankTransaction))
            {
                throw new DuplicateTransactionException();
            }

            try
            {
                await db.BankTransactions.AddAsync(bankTransaction);

                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }