public ICommandResult Handle(DeletarClienteCommand command) { if (!command.Valid()) { return(new GenericoClienteCommandResult(false, "Ops parece que o Cliente que quer deletar possui algum erro!", command.Notifications)); } if (_clienteRepository.BuscarClienteId(command.Id) == null) { return(new GenericoClienteCommandResult(false, "Cliente não encontrado", command.Notifications)); } _clienteRepository.Deletar(command.Id); return(new GenericoClienteCommandResult(true, "Cliente Deletado com sucesso!", command.Id)); }
public Task <Notas02Notification> Handle(DeletarClienteCommand command, CancellationToken cancellationToken) { _writeRepository.Delete(command.Id); return(Task.FromResult((Notas02Notification) new Notas02SuccessNotification())); }
public GenericoClienteCommandResult Deletar([FromBody] DeletarClienteCommand command, [FromServices] ClienteHandler handler) { return((GenericoClienteCommandResult)handler.Handle(command)); }
public IActionResult Delete(Guid id) { var command = new DeletarClienteCommand(id); return(Ok(_mediator.Send(command))); }