Added ability to delete transactions successfully

This commit is contained in:
Finn 2017-09-07 12:53:01 +01:00
parent 8034844cec
commit 416ac6343a
3 changed files with 48 additions and 24 deletions

View file

@ -48,4 +48,19 @@ sub image {
}
}
sub delete {
my $c = shift;
my $id = $c->param('id');
if ( my $transaction = $c->result_set->find($id) ) {
$transaction->delete;
$c->flash( success => 'Successfully deleted transaction' );
$c->redirect_to( '/admin/transactions' );
} else {
$c->flash( error => 'No transaction found' );
$c->redirect_to( '/admin/transactions' );
}
}
1;