public async Task <Speaker[]> GetSpeakers() { var talks = await conferencePersistence.GetTalksFromConferences(conferenceIds); var nameAndTalkCounts = new Dictionary <string, int>(); foreach (var talk in talks) { var speakerNames = talk.Speaker; foreach (var name in SpeakerParser.GetSpeakers(speakerNames)) { if (nameAndTalkCounts.ContainsKey(name)) { nameAndTalkCounts[name] += 1; } else { nameAndTalkCounts.Add(name, 1); } } } var speakers = new List <Speaker>(nameAndTalkCounts.Count); foreach (var nameAndTalkCount in nameAndTalkCounts) { var user = users.GetUser(nameAndTalkCount.Key); var speaker = new Speaker(nameAndTalkCount.Key, user.ProfileImageUrl, nameAndTalkCount.Value); speakers.Add(speaker); } var orderedSpeakers = speakers.OrderByDescending(s => s.TalkCount).ToArray(); return(orderedSpeakers); }
protected TalkViewModelBase(Talk talk) { TalkName = talk.TalkName; Description = talk.Description; ZonedTimeStamp = talk.DateOfTalkString; Speakers = SpeakerParser.GetSpeakers(talk.Speaker); }