Example #1
0
        public ActionResult Follow(int followedId, int followerId)
        {
            User userToFollow  = repo.GetById(followedId);
            User userFollowing = repo.GetById(followerId);

            if (!userToFollow.IsPrivate)
            {
                repo.Follow(followedId, followerId);
                //TODO: use notificatoins repository;
                NotificationsController.AddFollowNotification(followerId, followedId);
                return(RedirectToAction($"Details/{followedId}"));
            }
            else
            {
                NotificationsController.AddRequestNotification(followerId, followedId);
                return(RedirectToAction($"Details/{followedId}"));
            }
        }