//获取某话题的三个最新的问题 public TQ getTopThreeQuestionByTopicID(int id) { TQ tq = new TQ(); tq.topic = db.Topics.Find(id); tq.question = new List <TimeQuestion>(); List <Question> question = db.Questions.Where(a => a.QTopicType1 == id).ToList(); question = orderByQTime(question); for (int i = 0; i < question.Count() && i < 3; i++) { TimeQuestion add = new TimeQuestion(); add.question = question[i]; add.timespan = getTimeSpan(question[i].QTime); tq.question.Add(add); } return(tq); }
//获取某话题的三个最新的问题 public TQ getTopThreeQuestionByTopicID(int id) { TQ tq = new TQ(); tq.topic = db.Topics.Find(id); tq.question = new List<TimeQuestion>(); List<Question> question = db.Questions.Where(a => a.QTopicType1 == id).ToList(); question = orderByQTime(question); for (int i = 0; i < question.Count() && i < 3; i++) { TimeQuestion add = new TimeQuestion(); add.question = question[i]; add.timespan = getTimeSpan(question[i].QTime); tq.question.Add(add); } return tq; }