예제 #1
0
        public async Task <List <Message> > GetAllMessagesTranslated(int userId)
        {
            List <Message> allMessages    = _db.Message.ToList();
            var            user           = GetUser(userId);
            TR             miniTranslator = new TR();

            foreach (Message m in allMessages)
            {
                m.Content = await miniTranslator.Translate(m.Content, user.Language);
            }
            return(await Task.FromResult(allMessages));
        }
예제 #2
0
        public async Task <List <Message> > GetAllMessages(string language)
        {
            List <Message> messages = _db.Message.ToList();
            List <Message> translatedMessageList = new List <Message>();
            TR             tr = new TR();

            foreach (Message m in messages)
            {
                Message translatedMessage = new Message();
                translatedMessage.Content = await tr.Translate(m.Content, language);

                translatedMessage.MessageDateTime = m.MessageDateTime;
                translatedMessageList.Add(translatedMessage);
            }
            return(translatedMessageList);
        }