public IActionResult UpdateGame([FromRoute] int gameId, [FromBody] GameDto gameDto) { (IActionResult result, bool isOwner) = EnsureAuthorOwnsGame(gameDto, gameId); if (!isOwner) { return(result); } try { if (gameId == 0) { return(StatusCode(400, ErrorResponse.CustomErrorCode(400, "You're not updating a game."))); } repo.UpdateGame(gameDto, gameId); var updatedGameDto = new GameDto { Id = gameId, Author = gameDto.Author, Descr = gameDto.Descr, Genre = gameDto.Genre, Name = gameDto.Name }; var successResponse = responses.UpdateResponse(updatedGameDto); return(StatusCode(200, successResponse)); } catch (Exception e) { return(StatusCode(500, ErrorResponse.ServerError)); } }