Exemplo n.º 1
0
        public ActionResult AddOrRemoveFollower(FollowModel follower)
        {
            follower.FollowerId = User.Identity.GetUserId();

            var Follower = _followService.GetFollowerByUser(follower.UserId, follower.FollowerId);

            if (Follower == null)
            {
                _followService.AddFollower(new FollowBLL()
                {
                    UserId     = follower.UserId,
                    FollowerId = follower.FollowerId,
                });
            }
            else
            {
                _followService.RemoveFollower(Follower);
            }

            ViewBag.Count      = _followService.GetFollowersByUser(follower.UserId).Count();
            ViewBag.UserId     = follower.UserId;
            ViewBag.IsFollowed = Follower == null;
            return(PartialView("GetCount"));
        }