public void OnGet()
        {
            var cache       = new Microsoft.Extensions.Caching.Memory.MemoryCache(new Microsoft.Extensions.Caching.Memory.MemoryCacheOptions());
            var gameFactory = new StrangerThings.Game.GameFactory(new GoogleTranslator.Translator(@"D:\Development\Redweb\StrangerThings\StrangerThings\StrangerThings.Web\strangerthings.json"));

            var gameService = new StrangerThings.Game.GameService(cache, gameFactory);

            var game = gameService.CreateNewGame();

            Game = game;
        }
Exemple #2
0
        public AnswerResult Get(string id, string place, string time)
        {
            var cache       = new Microsoft.Extensions.Caching.Memory.MemoryCache(new Microsoft.Extensions.Caching.Memory.MemoryCacheOptions());
            var gameFactory = new StrangerThings.Game.GameFactory(new GoogleTranslator.Translator(@"D:\Development\Redweb\StrangerThings\StrangerThings\StrangerThings.Web\strangerthings.json"));

            var gameService = new StrangerThings.Game.GameService(cache, gameFactory);

            var game = gameService.GetGameFromId(id);

            var result = new AnswerResult();

            result.LocationCorrect = game.Answer.Place.Name == place;
            result.TimeCorrect     = game.Answer.Time.ToString() == time;

            result.Answer = $"{game.Answer.Place.Name} at {game.Answer.Time.ToString()}";

            return(result);
        }