コード例 #1
0
        private void RemoveRecipient()
        {
            foreach (DataGridViewRow selectedRow in _view.SelectedRows)
            {
                var name = selectedRow.Cells["Name"].Value.ToString();

                _recipientRepository.Remove(name);
            }
            _view.Update(_recipientRepository.Recipients);
        }
コード例 #2
0
        protected override async void OnDeleteExecute()
        {
            if (await _recipientRepository.HasPaymentsAsync(Recipient.ID))
            {
                await MessageDialogService.ShowInfoDialogAsync($"{Recipient.Name} cannot be deleted because it has corresponding payments.");

                return;
            }

            MessageDialogResult result =
                await MessageDialogService.ShowOkCancelDialogAsync(
                    $"Do you really want to delete the recipient {Recipient.Name}?", "Question");

            if (result == MessageDialogResult.Ok)
            {
                _recipientRepository.Remove(Recipient.Model);
                await _recipientRepository.SaveAsync();

                RaiseDetailDeletedEvent(Recipient.ID);
            }
        }
コード例 #3
0
        public async Task Delete(int id)
        {
            await _validator.ValidateForDeletion(id);

            await _recipientRepository.Remove(id);
        }