private async void getSpeakersAsync() { var speakerService = new SpeakerService(); var speakers = await speakerService.GetSpeakersAsync(); speakersTable.Source = new PlainTableSource(speakers.Select(x => x.Name).ToArray()); speakersTable.ReloadData(); }
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) { } }
public static async Task Run( [QueueTrigger(QueueName.CollectCalendarPage)] CollectCalendarPageData command, [Table(TableName.Meetup)] CloudTable meetupTable, [Table(TableName.MeetupSession)] CloudTable meetupSessionTable, [Table(TableName.Session)] CloudTable sessionTable, [Table(TableName.Speaker)] CloudTable speakerTable, [Table(TableName.Venue)] CloudTable venueTable, [Blob(ContainerName.PageData + PageDataBlobUrl, FileAccess.Write)] CloudBlockBlob calendarPageDataBlob, [Queue(QueueName.RenderPage)] CloudQueue renderQueue, ILogger log) { var meetupService = new MeetupService(meetupTable); var venueService = new VenueService(venueTable); var meetupSessionService = new MeetupSessionService(meetupSessionTable); var sessionService = new SessionService(sessionTable); var speakerService = new SpeakerService(speakerTable); var renderService = new CommandQueueService(renderQueue); var calendarPageModel = new CalendarPage(); var meetups = (await meetupService.GetMeetupsAsync()) .GroupBy(x => x.Year, (key, elements) => new { year = key, meetups = elements .OrderBy(x => x.Year) .ThenBy(x => x.Month) .ThenBy(x => x.Day) }) .OrderBy(x => x.year) .ToDictionary(x => x.year, element => element.meetups); var meetupSessions = await meetupSessionService.GetMeetupSessionsAsync(); var sessions = await sessionService.GetSessionsAsync(); var speakers = await speakerService.GetSpeakersAsync(); var venues = await venueService.GetVenuesAsync(); calendarPageModel.Years = meetups.Keys.ToArray(); calendarPageModel.CalendarYears = meetups.Values.Select(x => { var calendarYear = new CalendarYear(); calendarYear.Year = x.First().Year; calendarYear.Meetups = x.Select(y => { var meetupPage = new MeetupPage(); meetupPage.Meetup = y; meetupPage.Venue = venues .Single(z => z.Id == meetupPage.Meetup.VenueId); meetupPage.Sessions = meetupSessions .Where(z => z.MeetupId == meetupPage.Meetup.Id) .OrderBy(z => z.OrderN) .Select(z => { var agenda = new MeetupAgenda(); agenda.MeetupSession = z; agenda.Session = sessions .Single(q => q.Id == agenda.MeetupSession.SessionId); agenda.Speaker = speakers .Single(q => q.Id == agenda.Session.SpeakerId); return(agenda); }) .ToArray(); return(meetupPage); }) .ToArray(); return(calendarYear); }) .ToArray(); await calendarPageDataBlob.UploadTextAsync(JsonConvert.SerializeObject(calendarPageModel)); var renderCommand = new RenderPage { DataInstanceId = command.DataInstanceId, PublicUrl = calendarPageModel.PublicUrl, TemplateId = CalendarPage.TemplateId }; await renderService.SubmitCommandAsync(renderCommand); }