示例#1
0
        //Decline a invite and perserve the room you are allocated to.
        public void declineInvite(Invite invite)
        {
            using (InviteRepository inviteRepository = new InviteRepository("DefaultConnection"))
            {
                Player recipient = userLogic.findPLayer(invite.RecipientID);

                inviteRepository.removeInvite(invite.SenderID, invite.RecipientID);
            }
        }
示例#2
0
 //Finding the player (RecipientID) by the invite and giving the player a new room as well.
 //Its roomid is assigned to the requested roomid and then we are updating the player's room to that which it has accepted.
 //After accepting, we remove the recent generated invite.
 public void acceptInvite(Invite invite)
 {
     using (InviteRepository inviteRepository = new InviteRepository("DefaultConnection"))
     {
         Player recipient = userLogic.findPLayer(invite.RecipientID);
         recipient.Room    = new Room();
         recipient.Room.ID = invite.Room_id;
         userLogic.updatePlayer(recipient);
         foreach (Player_Status status in Player_statusLogic.GetAllPlayerStatusForOnePLayer(recipient))
         {
             Player_statusLogic.deletePlayerStatus(status);
         }
         Player_statusLogic.CreatePlayerStatusForARoom(recipient, recipient.Room);
         inviteRepository.removeInvite(invite.SenderID, invite.RecipientID);
     }
 }