Beispiel #1
0
        public ActionResult Unfollow(string id)
        {
            var currentUserId = this.User.Identity.GetUserId();

            Data.MyFollow follow = this.db.MyFollows.FirstOrDefault(x => x.UserId == currentUserId && x.FollowedUserId == id);

            this.db.MyFollows.Remove(follow);
            this.db.SaveChanges();
            return(this.RedirectToAction("Index", "MyFollow", "MyFollow/Index"));
        }
Beispiel #2
0
        public ActionResult FollowUserById(string id)
        {
            var currentUserId = this.User.Identity.GetUserId();

            Data.MyFollow myFollows = new Data.MyFollow
            {
                UserId         = currentUserId,
                FollowedUserId = id
            };
            this.db.MyFollows.Add(myFollows);
            this.db.SaveChanges();
            return(this.RedirectToAction("Index", "MyFollow", "MyFollow/Index"));
        }