Пример #1
0
        public static void AddFriend(this Member user, int friendId, Action onSuccess)
        {
            if (user.Id == friendId)
            {
                throw new MsgException("You should already be friends with yourself. Otherwise, please contact your local support group.");
            }
            if (user.IsFriendsWith(friendId))
            {
                throw new MsgException("You are already friends.");
            }
            if (FriendshipRequest.Exists(user.Id, friendId))
            {
                throw new MsgException("You have already sent a request to this user.");
            }

            FriendshipRequest.Create(user.Id, friendId);

            onSuccess();
        }