public ActionResult Index(TweetVM itemTweet) { try { if (ModelState.IsValid) { Tweet t = new Tweet() { UserId = Session["UserId"].ToString(), message = itemTweet.message, created = DateTime.Now }; obj.AddTweet(t); return(RedirectToAction("Index")); } else { return(View()); } } catch (Exception Ex) { Logger.WriteError(Ex, "Index", "Home"); return(View("Error")); } }
public TweetDTO AddTweet([FromBody] TweetDTO tweetDTO) { TweetDTO tweetObject = new TweetDTO(); tweetObject = TweetBL.AddTweet(tweetDTO.UserId, tweetDTO.TweetContent); return(tweetObject); }
public JsonResult AddTweet(TWEET tweet) { tweet.user_id = Session["UserId"].ToString(); tweet.created = DateTime.Now; tweetObj.AddTweet(tweet); Session["MessageCount"] = tweetObj.GetById(tweet.user_id).Count(); return(Json("", JsonRequestBehavior.AllowGet)); }