Esempio n. 1
0
        public async Task Matchup(IDialogContext context, LuisResult result)
        {
            List <String> teams = new List <String>();

            foreach (EntityRecommendation entityRecommendation in result.Entities)
            {
                switch (entityRecommendation.Type)
                {
                case "Team":
                    teams.Add(entityRecommendation.Entity);
                    break;
                }
            }

            if (teams.Count == 2)
            {
                Matchup matchup = await Scraper.ScrapeSchedule(teams[0], teams[1], this._matchupRepository);

                await context.PostAsync(JsonConvert.SerializeObject(matchup));
            }
            else
            {
                string message = $"Sorry I did not understand: " + string.Join(", ", result.Intents.Select(i => i.Intent));
                await context.PostAsync(message);
            }

            context.Wait(MessageReceived);
        }
 public void AddOrUpdate(Matchup matchup)
 {
     if (_matchups.ContainsKey(matchup.Key))
     {
         _matchups[matchup.Key] = matchup;
     }
     else
     {
         _matchups.Add(matchup.Key, matchup);
     }
 }