예제 #1
0
        public async Task <ApiResult> Edit(BankAccountEditModel model)
        {
            if (string.IsNullOrEmpty(model.BankAccount))
            {
                return(new ApiResult {
                    status = 0, msg = "银行卡号不能为空"
                });
            }
            if (string.IsNullOrEmpty(model.BankName))
            {
                return(new ApiResult {
                    status = 0, msg = "开户银行不能为空"
                });
            }
            if (string.IsNullOrEmpty(model.Name))
            {
                return(new ApiResult {
                    status = 0, msg = "持卡人姓名不能为空"
                });
            }
            User user = JwtHelper.JwtDecrypt <User>(ControllerContext);
            bool flag = await bankAccountService.UpdateByUserIdAsync(user.Id, model.Name, model.BankAccount, model.BankName);

            if (!flag)
            {
                return(new ApiResult {
                    status = 0, msg = "修改银行卡失败"
                });
            }
            return(new ApiResult {
                status = 1, msg = "修改银行卡成功"
            });
        }
        public async Task EditAsync(BankAccountEditModel model)
        {
            var bankAccount = await _bankAccountRepository.GetAsync(model.Id);

            BankAccountFactory.Create(model, bankAccount, _userId);
            _bankAccountRepository.Edit(bankAccount);
            await _unitOfWork.SaveChangesAsync();
        }
 public static void Create(BankAccountEditModel model, BankAccount entity, string userId)
 {
     entity.AccountNumber     = model.AccountNumber;
     entity.AccountHolderName = model.AccountHolderName;
     entity.BankName          = model.BankName;
     entity.BranchName        = model.BranchName;
     entity.Ifsc              = model.Ifsc;
     entity.UpdatedBy         = userId ?? "0";
     entity.UpdatedOn         = Utility.GetDateTime();
     entity.AccountCode       = model.AccountCode;
     entity.Description       = model.Description;
     entity.COA_AccountTypeId = model.COA_AccountTypeId;
     entity.LedgerType        = model.LedgerType;
     entity.AccountId         = model.AccountId;
     entity.AccountName       = model.AccountName;
 }
예제 #4
0
 public async Task <IActionResult> Edit([FromBody] BankAccountEditModel model)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState.GetErrorList()));
     }
     if (model.LedgerType == 2)
     {
         if (await _bankAccountManager.IsAccountNumberExistsForEditAsync(model.Id, model.AccountNumber))
         {
             return(BadRequest("Bank account number already exists"));
         }
     }
     try
     {
         await _bankAccountManager.EditAsync(model);
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
     return(Ok());
 }