public async Task <ActionResult> BetAsync([FromRoute] int tournamentId, [FromRoute] int marketId, [FromRoute] int selectionId) { try { int userId = GetUserIdFromToken(); await _tournamentService.BetAsync(userId, tournamentId, marketId, selectionId); return(Ok()); } catch (FinishedTournamentCoreException ex) { return(StatusCode((int)HttpStatusCode.BadRequest, "No bet can be take on this tournament.")); } catch (Exception ex) { return(StatusCode((int)HttpStatusCode.InternalServerError, ex.ToString())); } }