Example #1
0
        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));
        }
Example #2
0
 public Task <Notas02Notification> Handle(DeletarClienteCommand command, CancellationToken cancellationToken)
 {
     _writeRepository.Delete(command.Id);
     return(Task.FromResult((Notas02Notification) new Notas02SuccessNotification()));
 }
Example #3
0
 public GenericoClienteCommandResult Deletar([FromBody] DeletarClienteCommand command, [FromServices] ClienteHandler handler)
 {
     return((GenericoClienteCommandResult)handler.Handle(command));
 }
Example #4
0
        public IActionResult Delete(Guid id)
        {
            var command = new DeletarClienteCommand(id);

            return(Ok(_mediator.Send(command)));
        }