public IComandResult Handle(DeleteCollaboratorComand comand) { DeleteCollaboratorCommandResult comandResult = new DeleteCollaboratorCommandResult(); try { _collaboratorRepository.Delete(comand.Id); } catch (Exception ex) { AddNotification("Erro Delete", $"Erro ao excluir o usuário. Detalhe: {ex.Message}"); } return(comandResult); }
public ResultDto Delete(Guid id) { ResultDto resultDto; DeleteCollaboratorComand delete = new DeleteCollaboratorComand(); delete.Id = id; var result = (DeleteCollaboratorCommandResult)_collaboratorHandler.Handle(delete); if (_collaboratorHandler.IsValid()) { resultDto = new ResultDto(_collaboratorHandler.IsValid(), "Usuário deletado com sucesso", result); } else { resultDto = new ResultDto(_collaboratorHandler.IsValid(), "Não foi possível atualizar o usuário", _collaboratorHandler.Notifications); } return(resultDto); }