Beispiel #1
0
        public void Update_Update_a_valid_tweet_from_database_Returns_true()
        {
            bool expected = true;
            bool actual   = service.Update(tweetsList.FirstOrDefault(x => x.Id == 50));

            Assert.AreEqual(expected, actual);
        }
Beispiel #2
0
        public ActionResult Edit(Tweet tweet)
        {
            if (!ModelState.IsValid)
            {
                return(RedirectToAction("Index", "Tweet"));
            }
            int userID;

            int.TryParse(Session["UserID"].ToString(), out userID);
            tweet.PostDate = DateTime.Now;
            tweet.UserId   = userID;
            if (tweetBl.Update(tweet))
            {
                log.Info("A tweet has been updated");
                return(RedirectToAction("Index", "User"));
            }
            else
            {
                log.Error("Tweet could't be updated");
                return(RedirectToAction("Error", "Home"));
            }
        }