Beispiel #1
0
        public IHttpActionResult Follow(FollowingDtos followingDtos)
        {
            var userId = User.Identity.GetUserId();

            if (_unitOfWork.Following.Follow(userId, followingDtos))
            {
                return(BadRequest("Already Followed"));
            }
            var follow = new Following
            {
                FollowerId = userId,
                FolloweeId = followingDtos.FolloweeId
            };

            _unitOfWork.Following.Add(follow);
            _unitOfWork.Complete();
            return(Ok());
        }
Beispiel #2
0
 public bool Follow(string userId, FollowingDtos followingDtos)
 {
     return(_context.Followings.Any(f => f.FollowerId == userId && f.FolloweeId == followingDtos.FolloweeId));
 }