Create shared actions for admin and users with plugin bolierplate

OK. So the solution for now is to add an action to the admin_post method in the boilerplate

$this->loader->add_action( 'admin_post_generate_reservation', $plugin_shared, 'generate_reservation_file' );

and then in the shared class

  public function generate_reservation_file(){
    //code here

  }

the link in the front and backend

<a href="https://wordpress.stackexchange.com/questions/248775/<?php echo esc_url( admin_url("admin-post.php') ); ?>?action=generate_reservation&id=<?php echo $_GET['profil'] ?>" target="_blank"><strong>text</strong></a>

error code: 523