public async void IsBankAccountCreatePossible() { var form = new BankAccountForm() { Iban = "", Balance = 100.01, UserId = 100 }; var result = await _bankAccountService.Create(form); Assert.NotEqual(0, result); }
private void btnAddAccount_Click(object sender, System.EventArgs e) { if (txtAccName.Text.Trim() == "") { MessageBox.Show("Please enter an account name first."); } else { BankAccountForm NewAccount = new BankAccountForm(txtAccName.Text); NewAccount.Show(); lstUnlogged.Items.Add(NewAccount.BankAccount); } }
public async Task <int> Create(BankAccountForm form) { try { var newEntity = _mapper.Map <DaoBankAccount>(form); var createdEntry = _context.BankAccounts.Add(newEntity); await _context.SaveChangesAsync(); return(createdEntry.Entity.Id); } catch (Exception e) { throw new RepositoryException(typeof(DaoBankAccount).Name, eRepositoryExceptionType.Create); } }
public async Task <IActionResult> Update(BankAccountForm bankAccount) { var viewModel = new BankAccountListViewModel(); try { await _bankAccountService.Update(bankAccount); viewModel.BankAccounts = await _bankAccountService.GetAll(); } catch (Exception e) { viewModel.Error = new Shared.Models.GackoError(e); } return(View("Index", viewModel)); }
public async Task <int> Update(BankAccountForm form) { try { var updateEntity = this._mapper.Map <DaoBankAccount>(form); var updated = await _context.BankAccounts.FirstOrDefaultAsync(_ => _.Id == updateEntity.Id); _context.Entry(updated).CurrentValues.SetValues(updateEntity); await _context.SaveChangesAsync(); return(updated.Id); } catch (Exception e) { throw new RepositoryException(typeof(DaoBankAccount).Name, eRepositoryExceptionType.Update); } }
public async Task <int> Update(BankAccountForm form) { form.UserId = UserContext.UserId; return(await _bankAccountRepository.Update(form)); }
//~-资金账户 private void buttonItemBank_Click(object sender, EventArgs e) { BankAccountForm baf = new BankAccountForm(); baf.ShowDialog(); }