public async Task <IActionResult> Delete(int id)
        {
            var obj = new RemovePersonCommand {
                Id = id
            };
            var result = await _mediator.Send(obj);

            return(Ok(result));
        }
Esempio n. 2
0
        public void Handle(RemovePersonCommand Message)
        {
            var person = _repository.Find(Message.Id);

            if (person != null)
            {
                _repository.Remove(Message.Id);
            }
        }
        public Task <bool> Handle(RemovePersonCommand message, CancellationToken cancellationToken)
        {
            if (!message.IsValid())
            {
                NotifyValidationErrors(message);
                return(Task.FromResult(false));
            }

            _postRepository.Remove(message.Id);

            if (Commit())
            {
                _bus.RaiseEvent(new PersonRemovedEvent(message.Id));
            }

            return(Task.FromResult(true));
        }
Esempio n. 4
0
        public Task Handle(RemovePersonCommand message, CancellationToken cancellationToken)
        {
            if (!message.IsValid())
            {
                NotifyValidationErrors(message);
                return(Task.CompletedTask);
            }

            _personRepository.Remove(message.PersonId);

            if (Commit())
            {
                Bus.RaiseEvent(new PersonRemovedEvent(message.PersonId));
            }

            return(Task.CompletedTask);
        }
 public async Task Remove(Guid id)
 {
     var removeCommand = new RemovePersonCommand(id);
     await Bus.SendCommand(removeCommand);
 }
Esempio n. 6
0
        public void Remove(Guid id)
        {
            var removeCommand = new RemovePersonCommand(id);

            _bus.SendCommand(removeCommand);
        }
Esempio n. 7
0
        public async Task <ValidationResult> Remove(Guid id)
        {
            var removeCommand = new RemovePersonCommand(id);

            return(await _mediator.SendCommand(removeCommand));
        }
Esempio n. 8
0
        public void Remove(int id)
        {
            var removeCommand = new RemovePersonCommand(id);

            Bus.SendCommand(removeCommand);
        }