Ejemplo n.º 1
0
        public void RefreshChatRoom(int chatRoomId)
        {
            var newMsg = _messageRepository.FindMessageInfo(chatRoomId).FirstOrDefault();

            if (newMsg != null)
            {
                var newMsgModel = new MessageViewModel()
                {
                    Text            = newMsg.Text,
                    DateAdded       = newMsg.DateAdded,
                    SenderId        = newMsg.SenderId,
                    SenderName      = newMsg.SenderName,
                    SenderImagePath = Convert.ToBase64String(newMsg.SenderImage)
                };

                string newMsgJSON = JsonConvert.SerializeObject(newMsgModel);
                _chatHub.RefreshChatRoom(chatRoomId, newMsgJSON);
            }
        }