public ActionResult NewTweet(PersonTweetModel domainObject)
        {
            var user = User.Identity.Name;

            domainObject.Tweet.UserId  = user;
            domainObject.Tweet.Created = DateTime.Now;
            var viewModel = new PersonTweetModel
            {
                TweetsList = domainObject.TweetsList,
                Tweet      = domainObject.Tweet,
                Person     = domainObject.Person
            };

            TweetsDomain td = new TweetsDomain();

            td.SetMessage(domainObject.Tweet);
            return(View(viewModel));
        }
        public ActionResult UpdateTweet(PersonTweetModel domainObject)
        {
            var user = User.Identity.Name;

            domainObject.Tweet.UserId  = user;
            domainObject.Tweet.Created = DateTime.Now;
            var viewModel = new PersonTweetModel
            {
                TweetsList = domainObject.TweetsList,
                Tweet      = domainObject.Tweet,
                Person     = domainObject.Person
            };

            TweetsDomain td = new TweetsDomain();

            td.SetMessage(domainObject.Tweet);
            viewModel.TweetsList = db.Tweet.ToList();
            return(RedirectToAction("Index", "Home"));
        }
Example #3
0
        public ActionResult UpdateTweet(PersonTweetModel domainObject)
        {
            var user = User.Identity.Name;

            var p = db.Person.FirstOrDefault(t => t.user_id == user);

            domainObject.Tweet.user_id = user;
            domainObject.Tweet.created = DateTime.Now;
            var viewModel = new PersonTweetModel
            {
                TweetsList = domainObject.TweetsList,
                Tweet      = domainObject.Tweet,
                Person     = p
            };

            TweetsDomain td = new TweetsDomain();

            td.SetMessage(domainObject.Tweet);
            viewModel.TweetsList = db.TWEETs.ToList();
            return(RedirectToAction("Index", "Home", p));
        }