| Lines 123-131
          sub add {
      
      
        Link Here | 
        
          | 123 |  | 123 |  | 
        
          | 124 |     return try { | 124 |     return try { | 
        
          | 125 |  | 125 |  | 
          
            
              | 126 |         my $body = _to_model( $c->validation->param('body') ); | 126 |         my $patron = Koha::Patron->new_from_api( $c->validation->param('body') )->store; | 
            
              | 127 |  |  |  | 
            
              | 128 |         my $patron = Koha::Patron->new( _to_model($body) )->store; | 
        
          | 129 |  | 127 |  | 
        
          | 130 |         $c->res->headers->location( $c->req->url->to_string . '/' . $patron->borrowernumber ); | 128 |         $c->res->headers->location( $c->req->url->to_string . '/' . $patron->borrowernumber ); | 
        
          | 131 |         return $c->render( | 129 |         return $c->render( | 
  
    | Lines 196-206
          sub update {
      
      
        Link Here | 
        
          | 196 |      } | 194 |      } | 
        
          | 197 |  | 195 |  | 
        
          | 198 |     return try { | 196 |     return try { | 
            
              | 199 |         my $body = _to_model($c->validation->param('body')); |  |  | 
        
          | 200 |  | 197 |  | 
          
            
              | 201 |         $patron->set($body)->store; | 198 |         $patron->set_from_api($c->validation->param('body'))->store; | 
        
          | 202 |         $patron->discard_changes; | 199 |         $patron->discard_changes; | 
          
            
              | 203 |         return $c->render( status => 200, openapi => $patron ); | 200 |         return $c->render( status => 200, openapi => $patron->to_api ); | 
        
          | 204 |     } | 201 |     } | 
        
          | 205 |     catch { | 202 |     catch { | 
        
          | 206 |         unless ( blessed $_ && $_->can('rethrow') ) { | 203 |         unless ( blessed $_ && $_->can('rethrow') ) { | 
            
              | 207 | -  |  |  |