public async Task SaveReTweetAsync(Tweet tweet) { ServiceEventSource.Current.ServiceMessage(this, "Saving RT: {1} {2} {0}", tweet.Content, tweet.Keyword, tweet.Author.Name); try { using (InfluencerContext db = new InfluencerContext(getKey("ConnectionString"))) { db.InfluencerRTs.Add(new InfluencerRT { Author = tweet.Author.Alias, Date = tweet.Date, Influencer = tweet.TimeLineUser.Alias, Keyword = tweet.Keyword, TweetContent = tweet.Content, TweetId = $"{tweet.Id}-{tweet.Keyword}" }); await db.SaveChangesAsync(); } } catch (Exception ex) { ServiceEventSource.Current.ServiceMessage(this, "Failure: {0}", ex.Message); throw getException(ex); } }
public Task <IEnumerable <String> > RetrieveInfluencerListAsync() { return(Task.Run(() => { using (InfluencerContext db = new InfluencerContext(getKey("ConnectionString"))) { try { return (IEnumerable <string>)db.Influencers.Select(i => i.ScreenName).ToList(); } catch (Exception ex) { ServiceEventSource.Current.ServiceMessage(this, "Failure: {0}", ex.Message); throw getException(ex); } } })); }