public ActionResult Index([Bind(Include = "TweetMessage")] TweetFormViewModel model) { if (Session["Username"] == null) { return(RedirectToAction("Login")); } var tweetModel = new TweetViewModel(); tweetModel.TweetMessage = model.TweetMessage; tweetModel.FullName = Session["Username"].ToString(); tweetService.AddNewTweet(tweetModel); return(RedirectToAction("Index")); //we need to do this to avoid the postback of the page }
public IHttpActionResult AddTweet(TweetViewModel model) { tweetService.AddNewTweet(model); return(Ok("Success!")); }