Пример #1
0
        private void GetAllLeaguesFromApi()
        {
            GetApiClient();
            var leagues    = _client.GetAllLeagues();
            var discipline = new DisciplineRepository().GetByName("Football");

            foreach (var league in leagues)
            {
                if (!ContainsName(league.Name))
                {
                    league.Discipline = discipline;
                    SaveOrUpdate(league);
                }
            }
        }
Пример #2
0
        private void GetTeamsOfLeagueFromApi(League lg)
        {
            GetApiClient();
            var teams      = _client.GetTeamsForLeague(lg);
            var discipline = new DisciplineRepository().GetByName("Football");
            var repo       = new TeamRepository();

            foreach (var t in teams)
            {
                if (!repo.ContainsName(t.Name))
                {
                    t.Discipline = discipline;
                    repo.SaveOrUpdate(t);
                }
            }
        }