public async Task <ActionResult> FollowUser(int followedUserId) { int loggedUserId = int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value); var userIsExist = await _repo.UserIsExist(followedUserId); if (!userIsExist) { return(NotFound()); } bool followIsExist = await _repo.FollowIsExist(followedUserId, loggedUserId); if (followIsExist) { return(BadRequest()); } Follow follow = new Follow { FollowerId = loggedUserId, FollowedUserId = followedUserId }; await _repo.AddFollow(follow); await _repo.SaveAll(); // _repo.Add<Follow>(follow); return(Ok()); }