Example #1
0
        public List <Squad> GetLeagueDetails(string sportName)
        {
            string kabaddiJson = "{\"returnType\":\"response\",\"query\":\"query HomeSiteMatchQuery($slug: String = null) { site(slug: $slug) { slug name tours { id name } matches(page: 0, statuses: [NOT_STARTED]) { edges { id name startTime status squads { id name shortName flag { src type } flagWithName { src type } } tour { id name slug } } } }}\",\"variables\":{\"slug\":\"kabaddi\"}}";
            string json        = "{\"returnType\": \"response\",\"query\": \"query HomeQuery($slugs: [String] = null) { me { isGuestUser showOnboarding } sites(slugs: $slugs) { slug name tours { id name } matches(page: 0, statuses: [NOT_STARTED]) { edges { id name startTime status squads { id name shortName flag { src type } flagWithName { src type } } tour { id name slug } } } }}\",\"variables\": {\"slugs\":\"" + sportName + "\"}}";
            Dictionary <string, League>    leagueDetails        = new Dictionary <string, League>();
            Dictionary <string, NewLeague> kabaddiLeagueDetails = new Dictionary <string, NewLeague>();
            List <League.Site>             lstLeague            = new List <League.Site>();
            List <League.Matches>          matchLst             = new List <League.Matches>();
            List <MatchHistory>            matchHistoryLst      = new List <MatchHistory>();
            List <Squad> squadList = new List <Squad>();

            if (sportName != "Kabaddi")
            {
                leagueDetails = _matchRepo.ConstructJsonForLeague(json);
                string webroot = _env.WebRootPath;
                var    file    = System.IO.Path.Combine(webroot, "error.txt");
                using (StreamWriter writer = new StreamWriter(file, true))
                {
                    writer.WriteLine(DateTime.Now + ":---> ");
                }
                lstLeague = leagueDetails["data"].sites.ToList();
                matchLst  = GetSiteDetails(lstLeague);
                squadList = GetSquadList(matchLst);
            }
            else
            {
                kabaddiLeagueDetails = _matchRepo.ConstructJsonForNewLeague(kabaddiJson);
                NewLeague.newsites sites = kabaddiLeagueDetails["data"].site;
                squadList = GetNewSquadList(sites.matches);
            }
            return(squadList);
        }