Example #1
0
 public ActionResult Edit(InvestmentAccount investmentaccount)
 {
     if (ModelState.IsValid)
     {
         db.Entry(investmentaccount).State = EntityState.Modified;
         investmentaccount.ChangeState();
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.AccountStateId = new SelectList(db.AccountStates, "AccountStateId", "Description", investmentaccount.AccountStateId);
     ViewBag.ClientId       = new SelectList(db.Clients, "ClientId", "FullName", investmentaccount.ClientId);
     return(View(investmentaccount));
 }
Example #2
0
        public ActionResult Create(InvestmentAccount investmentaccount)
        {
            //This code has been modified
            if (ModelState.IsValid)
            {
                //Setting the investment account number to the next available one when creating a new investment account
                investmentaccount.SetNextAccountNumber();
                db.BankAccounts.Add(investmentaccount);
                investmentaccount.ChangeState();
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.AccountStateId = new SelectList(db.AccountStates, "AccountStateId", "Description", investmentaccount.AccountStateId);
            ViewBag.ClientId       = new SelectList(db.Clients, "ClientId", "FullName", investmentaccount.ClientId);
            return(View(investmentaccount));
        }
Example #3
0
        public ActionResult Create(InvestmentAccount investmentaccount)
        {
            investmentaccount.SetNextAccountNumber();

            if (ModelState.IsValid)
            {
                db.BankAccounts.Add(investmentaccount);
                db.SaveChanges();
                investmentaccount.ChangeState();
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.AccountStateId = new SelectList(db.AccountStates, "AccountStateId", "Description", investmentaccount.AccountStateId);
            ViewBag.ClientId       = new SelectList(db.Clients, "ClientId", "FullName", investmentaccount.ClientId);
            return(View(investmentaccount));
        }
Example #4
0
        public ActionResult Create(InvestmentAccount investmentaccount)
        {
            //Calling method for auto increment.
            investmentaccount.SetNextAccountNumber();

            if (ModelState.IsValid)
            {
                db.BankAccounts.Add(investmentaccount);

                db.SaveChanges();
                //Changes the accountstate if the account requirements are not fullfilled
                investmentaccount.ChangeState();
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            //Displays the fullname for the client
            ViewBag.ClientId       = new SelectList(db.Clients, "ClientId", "FullName", investmentaccount.ClientId);
            ViewBag.AccountStateId = new SelectList(db.AccountStates, "AccountStateId", "Description", investmentaccount.AccountStateId);
            return(View(investmentaccount));
        }