Beispiel #1
0
        public async Task<GameDetails> Get(int id)
        {
            var cachedResult = Cache.Default.Get(Cache.ThingKey(id)) as GameDetails;
            if (cachedResult != null)
            {
                Debug.WriteLine("Served Thing from Cache.");
                return cachedResult;
            }

            BoardGameGeekClient client = new BoardGameGeekClient();
            
            var thing = await client.LoadGame(id, false);

            Cache.Default.Set(Cache.ThingKey(id), thing, DateTimeOffset.Now.AddSeconds(15));
            return thing;
        }
Beispiel #2
0
        public async Task <GameDetails> Get(int id)
        {
            var cachedResult = Cache.Default.Get(Cache.ThingKey(id)) as GameDetails;

            if (cachedResult != null)
            {
                Debug.WriteLine("Served Thing from Cache.");
                return(cachedResult);
            }

            BoardGameGeekClient client = new BoardGameGeekClient();

            var thing = await client.LoadGame(id, false);

            Cache.Default.Set(Cache.ThingKey(id), thing, DateTimeOffset.Now.AddSeconds(15));
            return(thing);
        }
Beispiel #3
0
        public async Task <BoardGameLink> Get(int id)
        {
            var cachedResult = Cache.Default.Get(Cache.ThingKey(id)) as BoardGameLink;

            if (cachedResult != null)
            {
                Debug.WriteLine("Served Thing from Cache.");
                return(cachedResult);
            }

            BoardGameGeekClient client = new BoardGameGeekClient();

            var thing = await client.LoadGame(id, false);

            var result = new BoardGameLink {
                Name   = thing.Name,
                GameId = thing.GameId,
                Html   = $@"<div class='game-list game-data-grid'><div title='Játékosok száma'><div class='game-icon icon-players' aria-hidden='true'></div><span class='game-data'>{thing.MinPlayers}-{thing.MaxPlayers} játékos</span></div><div title='Játékidő'><div class='game-icon icon-time' aria-hidden='true'></div><span class='game-data'>{thing.MinPlayTime}-{thing.MaxPlayTime} perc játékidő</span></div><div title='Korosztály'><div class='game-icon icon-age' aria-hidden='true'></div><span class='game-data'>{thing.MinAge} éves kortól</span></div><div title='BGG értékelés'><div class='game-icon icon-rating' aria-hidden='true'></div><a href='https://boardgamegeek.com/boardgame/{thing.GameId}' target='_blank' title='BGG adatlap'><span class='game-data'>{Math.Round(thing.AverageRating,1)}/10</span></a></div></div>"
            };

            Cache.Default.Set(Cache.ThingKey(id), thing, DateTimeOffset.Now.AddSeconds(15));
            return(result);
        }