Lines 77-82
sub add {
Link Here
|
77 |
return try { |
77 |
return try { |
78 |
my $booking = Koha::Booking->new_from_api( $c->req->json ); |
78 |
my $booking = Koha::Booking->new_from_api( $c->req->json ); |
79 |
$booking->store; |
79 |
$booking->store; |
|
|
80 |
$booking->discard_changes; |
80 |
$c->res->headers->location( $c->req->url->to_string . '/' . $booking->booking_id ); |
81 |
$c->res->headers->location( $c->req->url->to_string . '/' . $booking->booking_id ); |
81 |
return $c->render( |
82 |
return $c->render( |
82 |
status => 201, |
83 |
status => 201, |
Lines 118-123
sub update {
Link Here
|
118 |
return try { |
119 |
return try { |
119 |
$booking->set_from_api( $c->req->json ); |
120 |
$booking->set_from_api( $c->req->json ); |
120 |
$booking->store(); |
121 |
$booking->store(); |
|
|
122 |
$booking->discard_changes; |
121 |
return $c->render( status => 200, openapi => $c->objects->to_api($booking) ); |
123 |
return $c->render( status => 200, openapi => $c->objects->to_api($booking) ); |
122 |
} catch { |
124 |
} catch { |
123 |
$c->unhandled_exception($_); |
125 |
$c->unhandled_exception($_); |