Ejemplo n.º 1
0
 public List <Bank> GetAllDomesticBanks()
 {
     using (var bankContext = new BankingContext())
     {
         return(bankContext.Bank.Select(bank => bank).ToList());
     }
 }
Ejemplo n.º 2
0
 public void UpdatePrepaidCard(PrepaidCard prepaidCard)
 {
     using (var bankContext = new BankingContext())
     {
         bankContext.PrepaidCard.Update(prepaidCard);
         bankContext.SaveChanges();
     }
 }
Ejemplo n.º 3
0
 public void InsertTransferOrder(TransferOrder transferOrder)
 {
     using (var bankContext = new BankingContext())
     {
         bankContext.TransferOrder.Add(transferOrder);
         bankContext.SaveChanges();
     }
 }
Ejemplo n.º 4
0
 public PaymentOrder GetPaymentOrderById(long paymentOrderId)
 {
     using (var bankContext = new BankingContext())
     {
         return(bankContext.PaymentOrder
                .FirstOrDefault(paymentOrder => paymentOrder.Id == paymentOrderId));
     }
 }
Ejemplo n.º 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));
     }
 }
Ejemplo n.º 7
0
 public void Update(Loan loan)
 {
     using (var bankContext = new BankingContext())
     {
         bankContext.Loan.Update(loan);
         bankContext.SaveChanges();
     }
 }
Ejemplo n.º 8
0
 public TransferOrder GetTransferOrderById(long transferOrderId)
 {
     using (var bankContext = new BankingContext())
     {
         return(bankContext.TransferOrder
                .FirstOrDefault(transferOrder => transferOrder.Id == transferOrderId));
     }
 }
Ejemplo n.º 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));
     }
 }
Ejemplo n.º 11
0
 public CreditCard GetCreditCardById(string cardId)
 {
     using (var bankContext = new BankingContext())
     {
         return(bankContext.CreditCard
                .FirstOrDefault(_card => _card.Id == cardId));
     }
 }
Ejemplo n.º 12
0
 public void InsertPaymentOrder(PaymentOrder paymentOrder)
 {
     using (var bankContext = new BankingContext())
     {
         bankContext.PaymentOrder.Add(paymentOrder);
         bankContext.SaveChanges();
     }
 }
Ejemplo n.º 13
0
 public void UpdateCreditCard(CreditCard creditCard)
 {
     using (var bankContext = new BankingContext())
     {
         bankContext.CreditCard.Update(creditCard);
         bankContext.SaveChanges();
     }
 }
Ejemplo n.º 14
0
 public List <PaymentMethod> GetPaymentMethods()
 {
     using (var bankingContext = new BankingContext())
     {
         return(bankingContext.PaymentMethod
                .Select(paymentMethod => paymentMethod)
                .ToList());
     }
 }
Ejemplo n.º 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();
         }
     }
 }
Ejemplo n.º 16
0
 public void DeletePaymentOrder(PaymentOrder paymentOrder)
 {
     using (var bankContext = new BankingContext())
     {
         try
         {
             bankContext.PaymentOrder.Remove(paymentOrder);
             bankContext.SaveChanges();
         }
         catch (Exception)
         {
             throw;
         }
     }
 }
Ejemplo n.º 17
0
 public void UpdateAccount(Account account)
 {
     using (var bankContext = new BankingContext())
     {
         try
         {
             bankContext.Account.Update(account as Account);
             bankContext.SaveChanges();
         }
         catch (Exception)
         {
             throw;
         }
     }
 }
Ejemplo n.º 18
0
 public void DeleteTransferOrder(TransferOrder transferOrder)
 {
     using (var bankContext = new BankingContext())
     {
         try
         {
             bankContext.TransferOrder.Remove(transferOrder);
             bankContext.SaveChanges();
         }
         catch (Exception)
         {
             throw;
         }
     }
 }
Ejemplo n.º 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);
         }
     }
 }
Ejemplo n.º 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);
         }
     }
 }
Ejemplo n.º 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);
         }
     }
 }
Ejemplo n.º 22
0
        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);
                }
            }
        }
Ejemplo n.º 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);
                }
            }
        }
Ejemplo n.º 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);
                }
            }
        }
Ejemplo n.º 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;
                }
            }
        }
Ejemplo n.º 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);
                }
            }
        }
Ejemplo n.º 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);
                }
            }
        }
Ejemplo n.º 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);
            }
        }