public async Task <ActionResult> Delete(AccountViewModel vm) { AccountDto toDelete = Mapper.Map <AccountViewModel, AccountDto>(vm); await _accountRepo.Delete(toDelete.Id); return(RedirectToAction("Index")); }
private void BtnDeleteAccount_Click(object sender, RoutedEventArgs e) { AccountDto accountDto = GetClickedAccount(sender); try { _accountRepo.Delete(accountDto.Id); } catch { MessageBox.Show("Unable to delete account. It has been used for other transactions."); } InitializeAccounts(); }