public async Task <IActionResult> FinishRental(int?id) { try { await _rentalsService.FinishRental(id); } catch (ArgumentException e) { return(NotFound(e.Message)); } catch (InvalidOperationException e) { return(StatusCode(StatusCodes.Status405MethodNotAllowed, e.Message)); } catch (Exception e) { return(BadRequest(e.Message)); } return(Ok()); }