コード例 #1
0
        public IActionResult Edit(EditBankAccountSystemViewModel model)
        {
            if (ModelState.IsValid)
            {
                var bank = _IBankAccountSystemRepository.GetById(model.Id);

                bank.BankAccountName   = model.BankAccountName;
                bank.BankAccountNumber = model.BankAccountNumber;
                bank.BankBranch        = model.BankBranch;
                bank.BankName          = model.BankName;
                bank.IsActive          = model.IsActive;

                _IBankAccountSystemRepository.Update(bank);

                TempData["MessageSuccess"] = "Cập nhật tài khoản ngân hàng thành công!";

                return(RedirectToAction("Index", "BankAccountSystem"));
            }
            return(View());
        }
コード例 #2
0
        public IActionResult Create(EditBankAccountSystemViewModel model)
        {
            if (ModelState.IsValid)
            {
                var result = _IBankAccountSystemRepository.Add(new Core.Entities.BankAccountSystem()
                {
                    BankAccountName   = model.BankAccountName,
                    BankAccountNumber = model.BankAccountNumber,
                    BankBranch        = model.BankBranch,
                    BankName          = model.BankName,
                    IsActive          = model.IsActive
                });

                if (result.Id > 0)
                {
                    return(RedirectToAction("Index", "BankAccountSystem"));
                }
            }
            return(View());
        }