async Task IGameLocalizationStore.SaveGameInfoAsync(GameInfo gameInfo, CancellationToken cancellationToken) { try { var gameInfoEntity = new GameLocalizationInfoEntity(gameInfo); var operation = TableOperation.InsertOrReplace(gameInfoEntity); var result = await _table.ExecuteAsync(operation, cancellationToken); if (result.HttpStatusCode / 100 != 2) { _logger.LogError("Non success code on insert {httpStatus}", result.HttpStatusCode); throw new Exception("Error http code on insert"); } } catch (StorageException e) { _logger.LogError(e, e.Message); throw; } }
async Task <GameInfo> IGameLocalizationStore.ResolveLocalizedGameInfoAsync(string language, string twitchCategoryId, CancellationToken cancellationToken) { try { TableOperation retrieveOperation = TableOperation.Retrieve <GameLocalizationInfoEntity>(twitchCategoryId, language); TableResult result = await _table.ExecuteAsync(retrieveOperation, cancellationToken); GameLocalizationInfoEntity gameInfoEntity = result.Result as GameLocalizationInfoEntity; if (gameInfoEntity == null) { return(null); } return(gameInfoEntity.ToGameInfo()); } catch (StorageException e) { _logger.LogError(e, e.Message); throw; } }