public JsonResult SendTweet(TweetPost post)
        {
            var status = "403";
            var token = service.GetUserTwitterToken(post.UserGuid);

            if (token != null)
            {
                var titter = new TitterService(cunsomerKey, cunsomerSecret);
                status = titter.SendMessage(token.OauthToken, token.OauthTokenSecret, post.Title, post.Description);
            }
            return Json(new{status}, JsonRequestBehavior.AllowGet);
        }
Esempio n. 2
0
        public async Task <ActionResult> SendTweet(string text)
        {
            TweetPost newTweet = null;

            try
            {
                newTweet = await TweetService.Tweet(text);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(Json(newTweet));
        }
Esempio n. 3
0
        public static async Task <TweetPost> Tweet(String textToTweet)
        {
            var tweet = await TweetAsync.PublishTweet(textToTweet);

            if (tweet.IsTweetPublished)
            {
                TweetPost newTweet = new TweetPost()
                {
                    Text         = tweet.Text,
                    PostUrl      = tweet.Url,
                    CreationDate = tweet.TweetLocalCreationDate
                };

                return(newTweet);
            }

            return(null);
        }