Beispiel #1
0
        public ActionResult AddTweet(TwitterModal _twitterModal)
        {
            string _ValidationMessage = string.Empty;

            try
            {
                if (Session["UserInfo"] != null)
                {
                    Person userModel = (Person)Session["UserInfo"];
                    Tweet  tweet     = new Tweet
                    {
                        user_id  = userModel.user_id,
                        fullname = userModel.fullname,
                        message  = _twitterModal._myTweet.message,
                        created  = DateTime.Now,
                    };

                    _Repository.SaveTweet(tweet, userModel.user_id, out _ValidationMessage);
                }
                else
                {
                    return(RedirectToAction("Login", "User"));
                }
            }
            catch (Exception ex)
            {
                AddErrors(ex, "Twitter", "AddTweet");
            }
            return(RedirectToAction("Home", "Twitter"));
        }