GetLastMessageByReceiverIdWithPagination(int receiverId, int page, int length) { var msgs = _repository.ChatMessages .GetLastMessagesByParticipantIdWithPagination(receiverId, page, length, ChatLastMessageDto.Selector(receiverId)); var dialogs = msgs.GroupBy(x => x.ChatId, (key, g) => g.OrderBy(e => e.ChatId).First()); return(dialogs); }
public ChatLastMessageDto GetLastChatMessageByChatId(int chatId, int receiverId) { var msg = _repository.ChatMessages .GetLastMessageByChatIdWithPagination(chatId, ChatLastMessageDto.Selector(receiverId)); /*var act = _mapper.Map<ChatLastMessageDto>(msg, opt => opt * .Items["receiverId"] = receiverId);*/ return(msg); }