コード例 #1
0
        private async Task <int> CheckIfPrivateDialogExists(DialogDTO privateChat)
        {
            DialogListDTO tmpChatList = await ListDialogs(new DialogFilter { Account = privateChat.Users[0] });

            foreach (DialogDTO chatTmp in tmpChatList.ResultDialogs)
            {
                if (chatTmp.Users.Count != 2)
                {
                    continue;
                }
                if (chatTmp.Users.Any(x => x.Id == privateChat.Users[1].Id))
                {
                    return(chatTmp.Id);
                }
            }

            return(-1);
        }
コード例 #2
0
        public async Task <int> HavePrivateDailog(string id1, string id2)
        {
            DialogListDTO tmpChatList = await ListDialogs(new DialogFilter { Account = new UserDTO {
                                                                                 Id = id1
                                                                             } });

            foreach (DialogDTO chatTmp in tmpChatList.ResultDialogs)
            {
                if (chatTmp.Users.Count != 2)
                {
                    continue;
                }
                if (chatTmp.Users.Any(x => x.Id == id2))
                {
                    return(chatTmp.Id);
                }
            }
            return(-1);
        }