Example #1
0
        public async Task <ActionResult> Index(string data)
        {
            var model = new TweetViewModel();

            if (data.IsNullOrWhiteSpace())
            {
                model.AllData   = "Like: http://localhost:49901/Tweet/?data=onepunchman";
                model.TweetData = FinalStore.GetTweets();

                var jj = new SentimentAnalysis();
            }
            else
            {
                TwitterAdapter.ConsumerKey    = ConfigurationManager.AppSettings["TwitterConsumerKey"];
                TwitterAdapter.ConsumerSecret = ConfigurationManager.AppSettings["TwitterConsumerSecret"];
                var results = await TwitterAdapter.SearchAsync(data);

                model.AllData = results;
            }

            return(View(model));
        }
 public static void AddTweet(Tweet tweet)
 {
     tweet.Created   = DateTime.UtcNow;
     tweet.Sentiment = SentimentAnalysis.GetSentiment(tweet.Text);
     TweetStore.Add(tweet);
 }