public static List <Question> GetAllQuestions() { List <Question> qList = new List <Question>(); using (CI = new Models.CombinedIntelligenceEntities()) { var result = CI.getAllQuestions().ToList(); foreach (var question in result) { Question cur = new Question() { Id = question.QuestionID, UserId = question.UserID, BodyText = question.Body, DatePosted = question.DatePosted, HeaderText = question.Header }; var votes = CI.getQVotes(question.QuestionID).ToList(); foreach (var vote in votes) { cur.Votes.Add(new Vote(vote.UserId, (VoteTypes)vote.Value)); } qList.Add(cur); var tags = CI.getQTags(question.QuestionID).ToList(); foreach (var tag in tags) { cur.AddTag(new Tag(tag.Name)); } } } return(qList); }
public void AddTag(Question question, string tag) { question.AddTag(tag); }