Exemple #1
0
        public TwitterAnalysisModel AddTwitterAnalysis(TwitterAnalysisModel analysis)
        {
            db.Analysis.Add(analysis);
            db.SaveChanges();

            return(analysis);
        }
        public ActionResult AddTwitterAnalysis(AnalysisModel analysis)
        {
            var twitterAnalysis = new TwitterAnalysisModel();

            twitterAnalysis.Description = string.Format("\"{0}\" vs \"{1}\"", analysis.WordOrPhrase1, analysis.WordOrPhrase2);
            twitterAnalysis.AnalyzedOn  = DateTime.Now;

            var apiManager = TwitterApiManager.GetTwitterApiManager();

            var phrase1 = apiManager.SearchForPhrase(analysis.WordOrPhrase1, 1);

            twitterAnalysis.Phrases.Add(phrase1);

            var phase2 = apiManager.SearchForPhrase(analysis.WordOrPhrase2, 2);

            twitterAnalysis.Phrases.Add(phase2);

            var manager = TwitterDalManager.GetTwitterDalManager();

            twitterAnalysis = manager.AddTwitterAnalysis(twitterAnalysis);

            return(Json(new { analysis = twitterAnalysis }, JsonRequestBehavior.AllowGet));
        }