public ActionResult Transactions() { if (TransactionCustomer == null) { TempData["error"] = "Client inconnu"; return(RedirectToAction("Index", "Home")); } ; var customer = customerRepo.GetCustomerByID(TransactionCustomer.ID); ViewBag.Solde = 0; foreach (var account in customer.Accounts) { ViewBag.Solde += accountRepo.GetAccountByID(account.ID).Solde; } var accountsId = customer.Accounts.Select(a => a.ID); return(View(transactionRepo.GetTransactions().Where(t => accountsId.Contains(t.Account.ID) && (DateTime.Now - t.Date).TotalDays < 30 ).OrderByDescending(t => t.Date).ToList())); }
public IActionResult GetTransactions() { return(Ok(_repo.GetTransactions())); }
public ActionResult InsertTestTransaction() { if (transactionRepo.GetTransactions().ToList().Count > 0) { throw new Exception("table transacion non vide"); } transactionRepo.InsertTransaction(new AccountToAcountTransaction() { Account = accountRepo.GetAccountByID(9), Amount = 5000, Date = DateTime.Now, TransactionType = TransactionType.CREDIT, Title = "virement - hacene kedjar" }); transactionRepo.InsertTransaction(new AccountToAcountTransaction() { Account = accountRepo.GetAccountByID(9), Title = "virement", Amount = 1260, Date = DateTime.Now, TransactionType = TransactionType.DEBIT }); transactionRepo.InsertTransaction(new AgencyTransaction { Account = accountRepo.GetAccountByID(9), Agency = "LCL Paris 5", Amount = 5000, Date = DateTime.Now, TransactionType = TransactionType.CREDIT }); transactionRepo.InsertTransaction(new AgencyTransaction { Account = accountRepo.GetAccountByID(9), Agency = "LCL Paris 6", Amount = 500, Date = DateTime.Now, TransactionType = TransactionType.DEBIT }); transactionRepo.InsertTransaction(new AgencyTransaction { Account = accountRepo.GetAccountByID(9), Agency = "LCL Paris 7", Amount = 5000, Date = DateTime.Now, TransactionType = TransactionType.CREDIT }); transactionRepo.InsertTransaction(new CDTransaction() { Account = accountRepo.GetAccountByID(9), Amount = 520, Date = DateTime.Now, TransactionType = TransactionType.DEBIT, AgencyName = "LCL", CashDispanserName = "CDT-1", CdType = CDType.INSIDE }); transactionRepo.InsertTransaction(new CDTransaction() { Account = accountRepo.GetAccountByID(9), Amount = 560, Date = DateTime.Now, TransactionType = TransactionType.DEBIT, AgencyName = "BNP", CashDispanserName = "CDT-BNP-1", CdType = CDType.OUTSIDE }); transactionRepo.Save(); return(RedirectToAction("Transactions", "Transaction")); }