Example #1
0
 /// <summary>
 /// Adds a new chat object into the database
 /// </summary>
 /// <param name="chat"></param>
 public void AddNewChat(db_Chat chat)
 {
     Debug.WriteLine("ADDING: " + chat.Player_Id);
     _context.MySqlDb.Query <db_Chat>(
         "INSERT INTO chat (chat_id, player_id, message) VALUES (" + chat.Chat_Id + ", " + chat.Player_Id + ", '" + chat.Message + "');",
         commandType: CommandType.Text);
 }
Example #2
0
        public void AddNewChat(ChatMessageInfo input)
        {
            // validate token
            if (!base.ValidateToken(input.Token))
            {
                return;
            }
            var tokenHelper = new Token();
            var userId      = Int32.Parse(tokenHelper.DecodeToken(input.Token).GetValue("id").ToString());
            var chat        = new db_Chat
            {
                Message   = input.Message,
                Player_Id = userId
            };

            _chatRepo.AddNewChat(chat);
        }