Ejemplo n.º 1
0
        public async Task <UserPostLike> UserLikePost(Guid userId, Guid postId)
        {
            if (postId == Guid.Empty)
            {
                throw new ArgumentNullException(nameof(postId));
            }
            if (userId == Guid.Empty)
            {
                throw new ArgumentNullException(nameof(userId));
            }

            var userPostLike = new UserPostLike
            {
                PostId = postId,
                UserId = userId,
            };
            await _context.AddRangeAsync(userPostLike).ConfigureAwait(false);

            return(userPostLike);
        }
Ejemplo n.º 2
0
        public async Task <UserFollow> UserFollowUser(Guid followerId, Guid followingId)
        {
            if (followerId == Guid.Empty)
            {
                throw new ArgumentNullException(nameof(followerId));
            }
            if (followingId == Guid.Empty)
            {
                throw new ArgumentNullException(nameof(followingId));
            }

            var userFollow = new UserFollow
            {
                FollowerId  = followerId,
                FollowingId = followingId,
            };

            await _context.AddRangeAsync(userFollow).ConfigureAwait(false);

            return(userFollow);
        }