public async Task <Message[]> GetAsync(string groupId, int currentPage) { var request = $"{API_URL}?groupId={groupId}"; var messages = await AuthorizedHttpClient.GetFromJsonAsync <Message[]>(request); messages.ToList().ForEach(async m => m.Username = await _userService.GetUserNameAsync(m.CreatedBy)); return(messages); }
private async Task OnReceiveMessageAsync(Message message) { message.Username = await _userService.GetUserNameAsync(message.CreatedBy); if (MessagesModels.ContainsKey(message.GroupId)) { MessagesModels[message.GroupId].Add(message, false); } OnNewMessage(message.GroupId); }