Пример #1
0
        public IActionResult ChooseAction(string userId, string action)
        {
            if (action == "follow")
            {
                followersServices.Follow(userId, this.User);
            }
            else if (action == "unfollow")
            {
                followersServices.Unfollow(userId, this.User);
            }
            else
            {
                return(BadRequest());
            }

            return(Ok());
        }
Пример #2
0
        public IActionResult ChooseAction(int userId, string action)
        {
            var currentUserId = this.userServices.GetUserId(User);

            if (action == "follow")
            {
                followersServices.Follow(userId, currentUserId);
            }
            else if (action == "unfollow")
            {
                followersServices.Unfollow(userId, currentUserId);
            }
            else
            {
                return(BadRequest());
            }

            return(Ok());
        }
        public IActionResult ChooseAction(string userId, string action)
        {
            var currentUserId = User.FindFirstValue(ClaimTypes.NameIdentifier);

            if (action == "follow")
            {
                followersServices.Follow(userId, currentUserId);
            }
            else if (action == "unfollow")
            {
                followersServices.Unfollow(userId, currentUserId);
            }
            else
            {
                return(BadRequest());
            }

            return(Ok());
        }