public async Task <IActionResult> Delete(int id) { var obj = new RemovePersonCommand { Id = id }; var result = await _mediator.Send(obj); return(Ok(result)); }
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)); }
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); }
public void Remove(Guid id) { var removeCommand = new RemovePersonCommand(id); _bus.SendCommand(removeCommand); }
public async Task <ValidationResult> Remove(Guid id) { var removeCommand = new RemovePersonCommand(id); return(await _mediator.SendCommand(removeCommand)); }
public void Remove(int id) { var removeCommand = new RemovePersonCommand(id); Bus.SendCommand(removeCommand); }