public List <Bank> GetAllDomesticBanks() { using (var bankContext = new BankingContext()) { return(bankContext.Bank.Select(bank => bank).ToList()); } }
public void UpdatePrepaidCard(PrepaidCard prepaidCard) { using (var bankContext = new BankingContext()) { bankContext.PrepaidCard.Update(prepaidCard); bankContext.SaveChanges(); } }
public void InsertTransferOrder(TransferOrder transferOrder) { using (var bankContext = new BankingContext()) { bankContext.TransferOrder.Add(transferOrder); bankContext.SaveChanges(); } }
public PaymentOrder GetPaymentOrderById(long paymentOrderId) { using (var bankContext = new BankingContext()) { return(bankContext.PaymentOrder .FirstOrDefault(paymentOrder => paymentOrder.Id == paymentOrderId)); } }
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)); } }
public void Update(Loan loan) { using (var bankContext = new BankingContext()) { bankContext.Loan.Update(loan); bankContext.SaveChanges(); } }
public TransferOrder GetTransferOrderById(long transferOrderId) { using (var bankContext = new BankingContext()) { return(bankContext.TransferOrder .FirstOrDefault(transferOrder => transferOrder.Id == transferOrderId)); } }
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)); } }
public CreditCard GetCreditCardById(string cardId) { using (var bankContext = new BankingContext()) { return(bankContext.CreditCard .FirstOrDefault(_card => _card.Id == cardId)); } }
public void InsertPaymentOrder(PaymentOrder paymentOrder) { using (var bankContext = new BankingContext()) { bankContext.PaymentOrder.Add(paymentOrder); bankContext.SaveChanges(); } }
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()); } }
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(); } } }
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; } } }
public void DeleteTransferOrder(TransferOrder transferOrder) { using (var bankContext = new BankingContext()) { try { bankContext.TransferOrder.Remove(transferOrder); bankContext.SaveChanges(); } catch (Exception) { throw; } } }
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); } } }
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); } } }
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); } } }
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); } } }
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); } } }
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; } } }
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); } } }
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); } } }
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); } }