public void addAccountBlocked(AccountsBlocked a) { direction d = ut.getRepository <direction>().GetById(1); a.Direction = d; a.Blocked = true; a.Type = "Blocked Account"; ut.getRepository <AccountsBlocked>().Add(a); ut.getRepository <direction>().Update(d); }
public ActionResult CreateBlocked(AccountsBlocked a) { if (ModelState.IsValid) { acse.addAccountBlocked(a); acse.Commit(); return(RedirectToAction("Index")); } else { return(View()); } }
//public AccountBankController() //{ // IAccountsService acse = new AccountsService(); //} //public AccountBankController(IAccountsService acse) //{ // this.acse = acse; //} // GET: AccountBank ActualizeAccount(); //public ActionResult Index() //{ // //ActualizeAccount(); // IEnumerable<Accounts> accounts = acse.GetMany().ToList(); // return View(accounts); //} public ActionResult Index() { IEnumerable <Accounts> accounts = acse.GetMany().ToList(); //AccountsSaving a = (AccountsSaving)accounts.Last(); List <IDictionary <string, string> > list = new List <IDictionary <string, string> >(); if (accounts.Count() != 0) { foreach (var item in accounts) { IDictionary <string, string> dict = new Dictionary <string, string>() { { "Id", null }, { "Type", null }, { "First Name", null }, { "Last Name", null }, { "Cin", null }, { "Account Balance", null }, { "Libelle", null }, { "Currency", null }, { "Note", null }, { "Salary", null }, { "Blocked", null }, { "Date Deblocked", null } }; dict["Id"] = item.Id.ToString(); dict["Type"] = item.Type.ToString(); dict["First Name"] = item.FNameClient.ToString(); dict["Last Name"] = item.LNameClient.ToString(); dict["Cin"] = item.CinClient.ToString(); dict["Account Balance"] = item.AccountBalance.ToString(); dict["Libelle"] = item.Libelle.ToString(); dict["Currency"] = item.Currency.ToString(); dict["Note"] = item.Note.ToString(); dict["Salary"] = item.salary.ToString(); if (dict["Type"] == "Saving Account") { AccountsSaving x = (AccountsSaving)item; dict["Blocked"] = x.Blocked.ToString(); dict["Date Deblocked"] = x.DateofSaving.ToString(); } else if (dict["Type"] == "Blocked Account") { //AccountsSaving account = (AccountsSaving)acse.GetById(dict["Id"]); //AccountsBlocked x = (AccountsBlocked)item; // dict["Blocked"] = account.Blocked.ToString(); //dict["Date Deblocked"] = account.DateofSaving.ToString(); AccountsBlocked x = (AccountsBlocked)item; dict["Blocked"] = x.Blocked.ToString(); dict["Date Deblocked"] = x.DateDeblocked.ToString(); } else { dict["Blocked"] = "____"; dict["Date Deblocked"] = "____"; } list.Add(dict); } } ViewBag.accounts = list; return(View()); }