예제 #1
0
 public List <Bank> GetAllDomesticBanks()
 {
     using (var bankContext = new BankingContext())
     {
         return(bankContext.Bank.Select(bank => bank).ToList());
     }
 }
예제 #2
0
 public void UpdatePrepaidCard(PrepaidCard prepaidCard)
 {
     using (var bankContext = new BankingContext())
     {
         bankContext.PrepaidCard.Update(prepaidCard);
         bankContext.SaveChanges();
     }
 }
예제 #3
0
 public void InsertTransferOrder(TransferOrder transferOrder)
 {
     using (var bankContext = new BankingContext())
     {
         bankContext.TransferOrder.Add(transferOrder);
         bankContext.SaveChanges();
     }
 }
예제 #4
0
 public PaymentOrder GetPaymentOrderById(long paymentOrderId)
 {
     using (var bankContext = new BankingContext())
     {
         return(bankContext.PaymentOrder
                .FirstOrDefault(paymentOrder => paymentOrder.Id == paymentOrderId));
     }
 }
예제 #5
0
 public Loan GetLoanById(string loanId)
 {
     using (var bankContext = new BankingContext())
     {
         return bankContext.Loan
             .FirstOrDefault(_loan => _loan.Id == loanId);
     }
 }
 public Account GetAccountById(string Id)
 {
     using (var bankContext = new BankingContext())
     {
         return(bankContext.Account
                .FirstOrDefault(_account => _account.Id == Id));
     }
 }
예제 #7
0
 public void Update(Loan loan)
 {
     using (var bankContext = new BankingContext())
     {
         bankContext.Loan.Update(loan);
         bankContext.SaveChanges();
     }
 }
예제 #8
0
 public TransferOrder GetTransferOrderById(long transferOrderId)
 {
     using (var bankContext = new BankingContext())
     {
         return(bankContext.TransferOrder
                .FirstOrDefault(transferOrder => transferOrder.Id == transferOrderId));
     }
 }
예제 #9
0
 public void AddTransaction(Transaction transaction)
 {
     using (var bankContext = new BankingContext())
     {
         bankContext.Transaction.Add(transaction);
         bankContext.SaveChanges();
     }
 }
 public Customer GetCustomerById(string customerId)
 {
     using (var bankContext = new BankingContext())
     {
         return(bankContext.Customer
                .FirstOrDefault(_customer => _customer.Id == customerId));
     }
 }
예제 #11
0
 public CreditCard GetCreditCardById(string cardId)
 {
     using (var bankContext = new BankingContext())
     {
         return(bankContext.CreditCard
                .FirstOrDefault(_card => _card.Id == cardId));
     }
 }
예제 #12
0
 public void InsertPaymentOrder(PaymentOrder paymentOrder)
 {
     using (var bankContext = new BankingContext())
     {
         bankContext.PaymentOrder.Add(paymentOrder);
         bankContext.SaveChanges();
     }
 }
예제 #13
0
 public void UpdateCreditCard(CreditCard creditCard)
 {
     using (var bankContext = new BankingContext())
     {
         bankContext.CreditCard.Update(creditCard);
         bankContext.SaveChanges();
     }
 }
 public List <PaymentMethod> GetPaymentMethods()
 {
     using (var bankingContext = new BankingContext())
     {
         return(bankingContext.PaymentMethod
                .Select(paymentMethod => paymentMethod)
                .ToList());
     }
 }
예제 #15
0
 public void DeleteLinkedProduct(string cardId, string productId)
 {
     using (var bankContext = new BankingContext())
     {
         var linkedProduct = bankContext.LinkedProducts
                             .First(product => product.CardId == cardId && product.ProductId == productId);
         if (linkedProduct != null)
         {
             bankContext.Remove(linkedProduct);
             bankContext.SaveChanges();
         }
     }
 }
예제 #16
0
 public void DeletePaymentOrder(PaymentOrder paymentOrder)
 {
     using (var bankContext = new BankingContext())
     {
         try
         {
             bankContext.PaymentOrder.Remove(paymentOrder);
             bankContext.SaveChanges();
         }
         catch (Exception)
         {
             throw;
         }
     }
 }
 public void UpdateAccount(Account account)
 {
     using (var bankContext = new BankingContext())
     {
         try
         {
             bankContext.Account.Update(account as Account);
             bankContext.SaveChanges();
         }
         catch (Exception)
         {
             throw;
         }
     }
 }
예제 #18
0
 public void DeleteTransferOrder(TransferOrder transferOrder)
 {
     using (var bankContext = new BankingContext())
     {
         try
         {
             bankContext.TransferOrder.Remove(transferOrder);
             bankContext.SaveChanges();
         }
         catch (Exception)
         {
             throw;
         }
     }
 }
예제 #19
0
 public List <LinkedProducts> GetAllCustomerDebitCardsLinkedProducts(string customerId)
 {
     using (var bankContext = new BankingContext())
     {
         var debitCardsWithLinkedProducts = bankContext.LinkedProducts
                                            .Where(linkedProduct => linkedProduct.CustomerId == customerId);
         if (debitCardsWithLinkedProducts != null)
         {
             return(debitCardsWithLinkedProducts.ToList());
         }
         else
         {
             return(null);
         }
     }
 }
예제 #20
0
 public List <PrepaidCard> GetAllCustomerPrepaidCards(string customerId)
 {
     using (var bankContext = new BankingContext())
     {
         var prepaidCards = bankContext.PrepaidCard
                            .Where(card => card.CustomerId == customerId);
         if (prepaidCards != null)
         {
             return(prepaidCards.ToList());
         }
         else
         {
             return(null);
         }
     }
 }
예제 #21
0
 public List <CreditCard> GetAllCustomerCreditCards(string customerId)
 {
     using (var bankContext = new BankingContext())
     {
         var creditCards = bankContext.CreditCard
                           .Where(card => card.CustomerId == customerId);
         if (creditCards != null)
         {
             return(creditCards.ToList());
         }
         else
         {
             return(null);
         }
     }
 }
        public List <Account> GetAllCustomerAccounts(string customerId)
        {
            using (var bankContext = new BankingContext())
            {
                var accounts = bankContext.Account
                               .Where(_account => _account.CustomerId == customerId);

                if (accounts != null)
                {
                    return(accounts.ToList());
                }
                else
                {
                    return(null);
                }
            }
        }
예제 #23
0
        public List <Transaction> GetAllCustomerTransaction(string customerId)
        {
            using (var bankContext = new BankingContext())
            {
                var transactionHistorys = bankContext.Transaction
                                          .Where(transactionHistory => transactionHistory.CustomerId == customerId);

                if (transactionHistorys != null)
                {
                    return(transactionHistorys.ToList());
                }
                else
                {
                    return(null);
                }
            }
        }
예제 #24
0
        public List <TransferOrder> GetAllCustomerTransferOrders(string customerId)
        {
            using (var bankContext = new BankingContext())
            {
                var transferOrders = bankContext.TransferOrder
                                     .Where(transferOrder => transferOrder.CustomerId == customerId)
                                     .ToList();

                if (transferOrders != null)
                {
                    return(transferOrders);
                }
                else
                {
                    return(null);
                }
            }
        }
예제 #25
0
        public List<Loan> GetAllCustomerLoans(string customerId)
        {
            using (var bankContext = new BankingContext())
            {
                var loans = bankContext.Loan
                    .Where(loan => loan.CustomerId == customerId)
                    .ToList();

                if (loans != null)
                {
                    return loans;
                }
                else
                {
                    return null;
                }
            }
        }
예제 #26
0
        public List <PaymentOrder> GetAllCustomerPaymentOrders(string customerId)
        {
            using (var bankContext = new BankingContext())
            {
                var paymentOrders = bankContext.PaymentOrder
                                    .Where(paymentOrder => paymentOrder.CustomerId == customerId)
                                    .ToList();

                if (paymentOrders != null)
                {
                    return(paymentOrders);
                }
                else
                {
                    return(null);
                }
            }
        }
예제 #27
0
        public List <Transaction> GetProductTransactionsByTimePeriod(string productId, DateTime startDate, DateTime endDate)
        {
            using (var bankContext = new BankingContext())
            {
                var transactionHistory = bankContext.Transaction
                                         .Where(transaction => transaction.DebitProductId == productId &&
                                                transaction.Date >= startDate &&
                                                transaction.Date <= endDate);

                if (transactionHistory != null)
                {
                    return(transactionHistory.ToList());
                }
                else
                {
                    return(null);
                }
            }
        }
예제 #28
0
        public string GetCustomerId(string userId, string password)
        {
            using (var bankContext = new BankingContext())
            {
                string customerId = "";
                var    user       = bankContext.User
                                    .FirstOrDefault(usr => usr.Id == userId);

                if (user != null)
                {
                    if (BCrypt.Net.BCrypt.Verify(password, user.Password))
                    {
                        customerId = user.CustomerId;
                    }
                }

                return(customerId);
            }
        }