Пример #1
0
        public TeamsList GetData(string url)
        {
            TeamsList res = new TeamsList();

            using (var client = new HttpClient())
            {
                var response     = client.GetStringAsync(url);
                var stringResult = response.Result;
                res = JsonConvert.DeserializeObject <TeamsList>(stringResult);
            }
            return(res);
        }
Пример #2
0
        public void SaveCompetitionTeams(TeamsList teams)
        {
            List <TeamEntity> teamEntities = new List <TeamEntity>();

            foreach (var item in teams.Teams)
            {
                TeamEntity team = new TeamEntity
                {
                    Code        = item.Code,
                    CrestURL    = item.CrestUrl,
                    MarektValue = item.SquadMarketValue,
                    Name        = item.Name,
                    ShortName   = item.ShortName
                };
                teamEntities.Add(team);
            }
            _context.Teams.AddRange(teamEntities);
            _context.SaveChanges();
        }