public ActionResult EditName(int?id)
        {
            if (db.Users.Find(User.Identity.GetUserId()).Disabled == true)
            {
                return(Content("<script language'javascript' type = 'text/javascript'> alert('Access Denied: Your account has been disabled. You are in a view-only mode.'); window.location='../Customer/Home';</script>"));
            }

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CheckingAccount checkingAccount = db.CheckingAccounts.Find(id);

            if (checkingAccount == null)
            {
                return(HttpNotFound());
            }

            ViewBag.AccountID = id;
            EditAccountNameViewModel editAccountNameVM = new EditAccountNameViewModel();

            editAccountNameVM.AccountName = checkingAccount.AccountName;

            return(View(editAccountNameVM));
        }
 public ActionResult EditName([Bind(Include = "AccountName")] EditAccountNameViewModel vm, int?id)
 {
     if (ModelState.IsValid)
     {
         CheckingAccount checkingAccount = db.CheckingAccounts.Find(id);
         checkingAccount.AccountName = vm.AccountName;
         db.SaveChanges();
         return(Content("<script language'javascript' type = 'text/javascript'> alert('Your checking account name has been updated'); window.location='../../Customer/Home';</script>"));
     }
     return(View(vm));
 }
 public ActionResult EditName([Bind(Include = "AccountName")] EditAccountNameViewModel vm, int?id)
 {
     if (ModelState.IsValid)
     {
         SavingAccount savingAccount = db.SavingAccounts.Find(id);
         savingAccount.AccountName = vm.AccountName;
         db.SaveChanges();
         return(Content("<script language'javascript' type = 'text/javascript'> alert('Confirmation: Successfully upadated savings account name!'); window.location='../Customer/Home';</script>"));
     }
     return(View(vm));
 }
Exemplo n.º 4
0
 public ActionResult EditName([Bind(Include = "AccountName")] EditAccountNameViewModel vm, String id)
 {
     if (ModelState.IsValid)
     {
         IRAccount irAccount = db.IRAccounts.Find(id);
         irAccount.AccountName = vm.AccountName;
         db.SaveChanges();
         return(Content("<script language'javascript' type = 'text/javascript'> alert('Confirmation: IRA name updated.'); window.location='../Customer/Home';</script>"));
     }
     return(View(vm));
 }
Exemplo n.º 5
0
 public ActionResult EditName([Bind(Include = "AccountName")] EditAccountNameViewModel vm, String id)
 {
     if (ModelState.IsValid)
     {
         StockPortfolio stockPortfolio = db.StockPortfolios.Find(id);
         stockPortfolio.AccountName = vm.AccountName;
         db.SaveChanges();
         return(RedirectToAction("Details", new { id = id }));
     }
     return(View(vm));
 }