// GET api/gameplayer/5
        public async Task<Result> Get(string id)
        {
            try
            {
                GamePlayerStorageInformation storageInfo = new GamePlayerStorageInformation(id.ToString());
                GamePlayer player = await ConfigurableDataProvider.Instance
                    .Get<GamePlayer, GamePlayerCacheable, GamePlayerTableStorage>(storageInfo);

                if (player == null)
                {
                    return new Result { ErrorCode = ErrorCode.ERROR_RETRIEVING_ACCOUNT };
                }

                GamePlayerAPIMorph morph = new GamePlayerAPIMorph();
                return new Result { ErrorCode = ErrorCode.ERROR_OK, Item = morph.ToAPIFormat(player) };
            }
            catch (Exception)
            {
                return new Result { ErrorCode = ErrorCode.ERROR_RETRIEVING_ACCOUNT };
            }
        }
Пример #2
0
 /// <summary>
 /// Returns a string that represents the GamePlayer instance.
 /// </summary>
 /// <param name="items"></param>
 /// <returns></returns>
 public string PlayerToJSON(GamePlayer item)
 {
     GamePlayerAPIMorph morph = new GamePlayerAPIMorph();
     return Converter.Serlialize<GamePlayerAPI>((GamePlayerAPI)morph.ToAPIFormat(item));
 }