KoogleV4/GameData/Repository/GameRepository.cs

49 lines
1.2 KiB
C#

using GameData.Model;
using GameModel;
using GameModel.Contracts;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GameData.Repository
{
public class GameRepository : IGameRepository
{
readonly ILogger<GameRepository> _log;
private ApiClient _client;
string UrlGameState => "items/gamestate";
string UrlGame => "items/game";
public GameRepository(ILogger<GameRepository> log, ApiClient apiClient)
{
_log = log;
_client = apiClient;
}
public GameState Load(Guid gameId)
{
throw new NotImplementedException();
}
public async Task Save(GameState gameState)
{
var gameStateDo = new GameStateDo(gameState.Id, gameState.GameId, gameState.GameName, gameState);
var res = await _client.Post<GameStateDo>(gameStateDo,UrlGameState);
}
public async Task Update(Game game)
{
await _client.Put<Game>(game, UrlGame);
}
public async Task<Game> Create(Game game)
{
return await _client.Post<Game>(game, UrlGame);
}
}
}