示例#1
0
文件: Model.cs 项目: NIZAOMA/nizaoma
 //获取某话题下的问题和某个评价最好的答案
 public TopicQuestion getBestAnswerByTopic(Topic topic)
 {
     TopicQuestion tq = new TopicQuestion();
     tq.topic = topic;
     tq.question = new List<Question>();
     tq.question = db.Questions.Where(d => d.QTopicType1 == topic.TID).ToList();
     tq.HotAnswer = new List<Answer>();
     tq.HotUser = new List<User>();
     for (int i = 0; i < tq.question.Count(); i++)
     {
         Answer answer = getHotAnswerByQuestionID(tq.question[i].QID);
         tq.HotAnswer.Add(answer);
         tq.HotUser.Add(findUserByID(answer.AUserID));
     }
     return tq;
 }
示例#2
0
文件: Model.cs 项目: NIZAOMA/nizaoma
 public IEnumerable<Topic> findTopicByFUserID(int id)
 {
     IEnumerable<FollowTopic> ft = db.FollowTopics.Where(d => d.FTUserID == id);
     List<Topic> t = new List<Topic>();
     for (var i = 0; i < ft.Count(); i++)
     {
         Topic tp = new Topic();
         tp = db.Topics.Find(ft.ToList()[i].FollowingTID);
         t.Add(tp);
     }
     return t.AsEnumerable();
 }