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")); }
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")); }