예제 #1
0
        public async Task Init()
        {
            var listMTVS = await _SeasonService.Get <List <TvshowSeason> >(new TvshowSeasonSearchRequest
            {
                MovieAndTvshowId = MTVSId
            });

            SeasonsList.Clear();
            foreach (var mtvs in listMTVS)
            {
                SeasonsList.Add(mtvs);
            }
        }
        public async Task Init()
        {
            if (SeasonsList.Count == 0)
            {
                var seasons = await _apiServiceSeasons.Get <List <Seasons> >(null);

                if (seasons.Count > 0)
                {
                    foreach (var item in seasons)
                    {
                        SeasonsList.Add(item);
                    }
                }
                else
                {
                    await Application.Current.MainPage.DisplayAlert("Information", "There is no seasons yet.", "OK");
                }
            }

            if (SelectedSeason != null)
            {
                ClubsList.Clear();
                var clubLeague = await _apiServiceClubs.GetById <List <ClubsLeague> >(selectedLeague.Id, "ClubsInLeague");

                if (clubLeague.Count > 0)
                {
                    int counter = 1;
                    foreach (var item in clubLeague.Where(x => x.SeasonId == SelectedSeason.Id).OrderByDescending(x => x.Points))
                    {
                        var club = await _apiServiceClubs.GetById <Clubs>(item.ClubId);

                        if (club != null)
                        {
                            ClubsList.Add(new ClubPoints
                            {
                                Points       = item.Points,
                                Id           = club.Id,
                                Logo         = club.Logo,
                                Name         = club.Name,
                                Abbreviation = club.Abbreviation,
                                Position     = counter
                            });
                        }
                        counter += 1;
                    }
                }
            }
        }