示例#1
0
        public async Task <ActionResult> Delete(AccountViewModel vm)
        {
            AccountDto toDelete = Mapper.Map <AccountViewModel, AccountDto>(vm);
            await _accountRepo.Delete(toDelete.Id);

            return(RedirectToAction("Index"));
        }
示例#2
0
        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();
        }