コード例 #1
0
        private async Task GetSponsors()
        {
            try
            {
                var talkDtOs = await _sponsorService.GetSponsorsAsync(CancellationToken.None);

                LatestStories.Clear();
                FeaturedStories.Clear();
                foreach (var talkDtO in talkDtOs)
                {
                    var sponsorViewModel = new SponsorViewModel(talkDtO);
                    LatestStories.Add(sponsorViewModel);
                    if (talkDtO.SponsorLevel != "Gold" && talkDtO.SponsorLevel != "Silver")
                    {
                        FeaturedStories.Add(sponsorViewModel);
                    }
                }
            }
            catch (Exception e)
            {
            }
        }
コード例 #2
0
        private async Task GetSpeakers()
        {
            try
            {
                var speakerDtos = (await _speakerService.GetSpeakersAsync()).ToList();
                LatestStories.Clear();
                FeaturedStories.Clear();

                var featuredSpeakers = speakerDtos.OrderBy(x => Guid.NewGuid()).Take(5);

                foreach (var speaker in featuredSpeakers)
                {
                    featuredStories.Add(speaker);
                }

                foreach (var speaker in speakerDtos)
                {
                    LatestStories.Add(speaker);
                }
            }
            catch (Exception e)
            {
            }
        }