Пример #1
0
        public async Task <IActionResult> All()
        {
            var user = await GetKahlaUser();

            var contacts = await _dbContext.MyContacts(user.Id).ToListAsync();

            foreach (var contact in contacts)
            {
                contact.Online = contact.Discriminator == nameof(PrivateConversation) ?
                                 _onlineJudger.IsOnline(contact.UserId) : false;
            }
            return(Json(new AiurCollection <ContactInfo>(contacts)
            {
                Code = ErrorType.Success,
                Message = "Successfully get all your friends."
            }));
        }
Пример #2
0
        public async Task <IActionResult> All()
        {
            var user = await GetKahlaUser();

            var contacts = await _dbContext.MyContacts(user.Id).ToListAsync();

            foreach (var contact in contacts)
            {
                if (contact.LatestMessage != null)
                {
                    contact.LatestMessage.Sender = contact.Sender.Build(_onlineJudger);
                }
                contact.Online = contact.Discriminator == nameof(PrivateConversation) ?
                                 _onlineJudger.IsOnline(contact.UserId, !contact.EnableInvisiable) : null;
            }
            return(this.Protocol(new AiurCollection <ContactInfo>(contacts)
            {
                Code = ErrorType.Success,
                Message = "Successfully get all your friends."
            }));
        }
Пример #3
0
 public KahlaUser Build(OnlineJudger judge)
 {
     IsOnline = judge.IsOnline(Id);
     return(this);
 }
Пример #4
0
 public KahlaUser Build(OnlineJudger judge)
 {
     IsOnline = judge.IsOnline(Id, !EnableInvisiable);
     return(this);
 }