Ejemplo n.º 1
0
 public AnswerListProfileViewModel GetAnswerListProfileModelForQuery(string userName, int page, IQueryable<Answer> query)
 {
     var answers = GetPageFor(query, page).ToList();
     var userProfile = GetUserProfile(userName);
     var answerModels = GetAnswerModels(answers);
     var answerListModel = new AnswerListViewModel()
     {
         Answers = answerModels.ToList()
     };
     var model = new AnswerListProfileViewModel()
     {
         Profile = userProfile,
         AnswerList = answerListModel
     };
     return model;
 }
Ejemplo n.º 2
0
 private void InitializeMoreButton(AnswerListViewModel answerList)
 {
     foreach (var answer in answerList.Answers)
     {
         var button = answer.CommentsMoreButton;
         button.RequestUrl = Url.RouteUrl("Comments", new { answerId = answer.Answer.AnswerId, page = 2 });
         button.HasMore = _answersService.HasManyCommentPages(answer.Answer.AnswerId);
         button.TargetElementId = "comments-" + answer.Answer.AnswerId;
         answer.TotalComments = _answersService.GetCommentNumber(answer.Answer.AnswerId);
     }
 }