public async Task <IActionResult> DeleteAccount(int accountId) { var command = new RemoveAccount(accountId); var response = await _mediator.Send(command); if (response.HasMessages) { return(BadRequest(response.Messages)); } return(Ok()); }
private async Task DellIdentTask(string ident, RestClientMP server) { CommonResult result = await server.DellIdent(ident); if (result.Error == null) { // Settings.EventBlockData = await server.GetEventBlockData(); ItemsList <NamedValue> resultN = await server.GetRequestsTypes(); Settings.TypeApp = resultN.Data; /*viewModel.*/ RemoveAccount.Execute(ident); //removeLs(ident); Device.BeginInvokeOnMainThread(async() => { IsRefreshing = true; await RefreshPaysData(); IsRefreshing = false; }); MessagingCenter.Send <Object, AccountInfo>(this, "RemoveIdent", Settings.Person.Accounts.Where(x => x.Ident == ident).FirstOrDefault()); } else { await DisplayAlert(AppResources.ErrorTitle, result.Error, "ОК"); } //Device.BeginInvokeOnMainThread(async () => //{ // IsRefreshing = true; // await RefreshPaysData(); // IsRefreshing = false; //}); }
private void RemoveAccount_Click(object sender, EventArgs e) { var removeAccountForm = new RemoveAccount(); if (removeAccountForm.ShowDialog() == DialogResult.OK) { Account removeAccount = db.Accounts.Find(removeAccountForm.accountId); try { if (removeAccount != null) { db.Accounts.Remove(removeAccount); db.SaveChanges(); // UpdateGrid(); } } catch { MessageBox.Show("There is no Account with this ID!"); } } }
private void btnRemove_Click(object sender, EventArgs e) { Account account = (Account)lstAccounts.SelectedItem; RemoveAccount?.Invoke(account.Id); }
public Task Handle(RemoveAccount notification, CancellationToken cancellationToken) { service.Remove(notification.AccountId); return(Task.CompletedTask); }