public async Task <IActionResult> ChangeBankAccount(ChangeBankAccountViewModel model)
        {
            if (ModelState.IsValid)
            {
                var r = await _accountService.ChangeBankAccount(CurrentUser.Id, model, CurrentUser.Username);

                this.AddAlert(r);
                return(RedirectToAction("ChangeBankAccount"));
            }
            return(View(model));
        }
        public async Task <IActionResult> ChangeBankAccount(ChangeBankAccountViewModel model)
        {
            if (ModelState.IsValid)
            {
                var r = await _accountService.ChangeBankAccount(CurrentUser.Id, model, CurrentUser.Username);

                this.AddAlert(r, "Bạn cập nhật thông tin ngần hàng thành công!");



                //return RedirectToAction("ChangeBankAccount");
            }
            return(View(model));
        }
Example #3
0
        public async Task <bool> ChangeBankAccount(int id, ChangeBankAccountViewModel model, string username)
        {
            var entity = await _accountRepository.GetByIdAsync(id, false);

            if (entity != null)
            {
                entity.BankAccountBank   = model.Bank;
                entity.BankAccountBranch = model.Branch;
                entity.BankAccountName   = model.Name;
                entity.BankAccountNumber = model.Number;
                entity.DateModified      = DateTime.Now;
                entity.UserModified      = username;

                await _accountRepository.UpdateAsync(entity);

                return(true);
            }
            return(false);
        }