Exemplo n.º 1
0
        public ActionResult New(int id)
        {
            var customerAccount = _customerAccContext.Get(id);
            var viewModel       = new TellerPostViewModel
            {
                CustomerAccount = customerAccount,
            };

            return(View("TellerPostForm", viewModel));
        }
Exemplo n.º 2
0
        public ActionResult New(int id)
        {
            var customerAccount = _customerAccContext.Get(id);
            var loan            = new Loan
            {
                CustomerAccount = customerAccount
            };

            return(View("LoanForm", loan));
        }
Exemplo n.º 3
0
        public ActionResult Save(CustomerAccount account)
        {
            int userId = Convert.ToInt32(Request.Form["userId"]);
            int id     = Convert.ToInt32(Request.Form["id"]);

            if (ModelState.IsValid)
            {
                var accountInDb = _context.Get(account.Id);
                if (id == 0) //add account
                {
                    var customerId   = Request.Form["customerId"];
                    var customerName = _customerContext.GetByCustomerId(customerId).FullName;
                    account.CustomerId    = customerId;
                    account.CreatedAt     = DateTime.Now;
                    account.AccountName   = customerName;
                    account.IsOpen        = true;
                    account.AccountNumber = _context.GenerateAccountNumber(customerId, account.AccountType.ToString());
                    _context.Save(account);
                    TempData["Success"] = "Account Created Successfully";
                    return(RedirectToAction("Index"));
                }
                if (account.Id != 0)   //update account
                {
                    accountInDb.AccountName = account.AccountName;
                    accountInDb.BranchId    = account.BranchId;
                    accountInDb.Lien        = account.Lien;
                    _context.Update(account);
                    TempData["Success"] = "Update Successful";
                    return(RedirectToAction("Index"));
                }
            }
            var customer  = _customerContext.Get(userId);
            var branches  = _userContext.GetBranches().ToList();
            var viewModel = new NewCustomerAccountViewModel
            {
                Customer = customer,
                Branches = branches
            };

            return(View("CustomerAccountForm", viewModel));
        }