コード例 #1
0
        public void deleteChat(Models.Chat chat)
        {
            var chatRemove = Data.allChats.FindIndex(f => f.Id == chat.Id);

            if (chatRemove > -1)
            {
                Data.allChats.RemoveAt(chatRemove);
            }
        }
コード例 #2
0
        public void CreateChat(Models.Chat newChat)
        {
            newChat.Id = Guid.NewGuid().ToString();
            Data.allChats.Add(newChat);

            if (newChat.Visibility == Enums.VisibilityChat.publicChat)
            {
                Clients.All.addChat(newChat);
            }
            else if (newChat.Visibility == Enums.VisibilityChat.privateChat)
            {
                Clients.Clients(newChat.UsersConected.Select(f => f.ConnectionID).ToList()).addChat(newChat);
            }
        }