ArmedCards.BusinessLogic.AppServices.GamePlayerKickVote.CheckVotes.Execute C# (CSharp) Method

Execute() public method

Check to see if the user has enough votes to be kicked
public Execute ( Int32 gameID, Int32 kickUserId ) : void
gameID System.Int32 The ID of the game the user belongs to
kickUserId System.Int32 The ID of the user to kick
return void
        public void Execute(Int32 gameID, Int32 kickUserId)
        {
            Int32 votedToKick = 0;
            Int32 votedNotToKick = 0;

            _checkVotes.Execute(gameID, kickUserId, out votedToKick, out votedNotToKick);

            Boolean kickUser = votedToKick > votedNotToKick;

            Entities.User kickedUser = _selectUser.Execute(kickUserId);

            if (votedToKick > 0)
            {
                _sendMessage.VoteComplete(gameID, kickedUser, votedToKick, votedNotToKick, kickUser);
            }

            if (kickUser)
            {
                //TODO: When spectator's can be kicked this will need to change
                _leaveGame.Execute(gameID, kickedUser, Entities.Enums.GamePlayerType.Player);
            }
        }