public ICommandResult Handle(ExcluirTelaCommand command) { if (!command.IsValidCommand()) { return(new CommandResult(false, "Por favor, verificar os campos abaixo", command.Notifications)); } var tela = _telaRepository.Tela(command.Id); if (tela == null) { return(new CommandResult(false, "A tela não existe na base de dados", new { })); } _telaRepository.Excluir(tela.Id); return(new CommandResult(true, "Tela excluída com sucesso", new { Id = tela.Id, Titulo = tela.Titulo })); }
public ICommandResult Excluir([FromBody] ExcluirTelaCommand command) { var result = (CommandResult)_handler.Handle(command); return(result); }