View | Details | Raw Unified | Return to bug 23893
Collapse All | Expand All

(-)a/Koha/REST/V1/Cities.pm (-4 / +2 lines)
Lines 76-82 sub add { Link Here
76
    my $c = shift->openapi->valid_input or return;
76
    my $c = shift->openapi->valid_input or return;
77
77
78
    return try {
78
    return try {
79
        my $city = Koha::City->new( _to_model( $c->validation->param('body') ) );
79
        my $city = Koha::City->new_from_api( $c->validation->param('body') );
80
        $city->store;
80
        $city->store;
81
        $c->res->headers->location( $c->req->url->to_string . '/' . $city->cityid );
81
        $c->res->headers->location( $c->req->url->to_string . '/' . $city->cityid );
82
        return $c->render(
82
        return $c->render(
Lines 115-122 sub update { Link Here
115
    }
115
    }
116
116
117
    return try {
117
    return try {
118
        my $params = $c->req->json;
118
        $city->set_from_api( $c->validation->param('body') );
119
        $city->set( _to_model($params) );
120
        $city->store();
119
        $city->store();
121
        return $c->render( status => 200, openapi => $city->to_api );
120
        return $c->render( status => 200, openapi => $city->to_api );
122
    }
121
    }
123
- 

Return to bug 23893