Пример #1
0
        public virtual void DeleteFriendByBlacklist(long userId, long fid)
        {
            FollowerService followService = new FollowerService();

            String     condition = "User.Id=" + userId + " and Friend.Id=" + fid + " and Status=" + FriendStatus.Approved;
            FriendShip ship      = db.find <FriendShip>(condition).first();

            if (ship != null)
            {
                db.delete(ship);
                if (followService.IsFollowing(userId, fid))
                {
                    followService.DeleteFollow(userId, fid);
                }
                recountFriends(userId);
                recountFriends(fid);

                return;
            }

            condition = "User.Id=" + fid + " and Friend.Id=" + userId + " and Status=" + FriendStatus.Approved;
            ship      = db.find <FriendShip>(condition).first();
            if (ship != null)
            {
                db.delete(ship);
                if (followService.IsFollowing(fid, userId))
                {
                    followService.DeleteFollow(fid, userId);
                }
                recountFriends(userId);
                recountFriends(fid);
            }
        }
Пример #2
0
        public virtual void DeleteFriendByBlacklist( int userId, int fid )
        {
            FollowerService followService = new FollowerService();

            String condition = "User.Id=" + userId + " and Friend.Id=" + fid + " and Status=" + FriendStatus.Approved;
            FriendShip ship = db.find<FriendShip>( condition ).first();
            if (ship != null) {
                db.delete( ship );
                if (followService.IsFollowing( userId, fid )) followService.DeleteFollow( userId, fid );
                recountFriends( userId );
                recountFriends( fid );

                return;
            }

            condition = "User.Id=" + fid + " and Friend.Id=" + userId + " and Status=" + FriendStatus.Approved;
            ship = db.find<FriendShip>( condition ).first();
            if (ship != null) {
                db.delete( ship );
                if (followService.IsFollowing( fid, userId )) followService.DeleteFollow( fid, userId );
                recountFriends( userId );
                recountFriends( fid );

            }
        }