Example #1
0
 public AnswerListProfileViewModel GetAnswersListProfileViewModel(string userName, int page)
 {
     var query = GetAnswersQuery(userName);
     AnswerListProfileViewModel model = GetAnswerListProfileModelForQuery(userName, page, query);
     var initializer = new PaginationInitializer("AnswersProfilePage", "answers-list", userName, _pageSize);
     initializer.InitializePaginationModel(model.AnswerList, page, query.Count());
     return model;
 }
Example #2
0
 public InboxViewModel GetInboxViewModel(string userName, int page)
 {
     var profile = GetUserProfile(userName);
     var viewModel = new InboxViewModel() { Profile = profile, QuestionDetails = GetQuestionDetailAnswerList(userName, page) };
     viewModel.ConfirmModal = new ConfirmModalViewModel("confirm-delete-modal")
     {
         Question = InboxStrings.DeleteConfirm,
         YesButton = InboxStrings.YesButton,
         NoButton = InboxStrings.NoButton
     };
     var paginationInitializer = new PaginationInitializer("InboxPage", "inbox-questions", userName, _pageSize);
     paginationInitializer.InitializePaginationModel(viewModel, page, GetIncomingQuestionsCount(userName));
     return viewModel;
 }
Example #3
0
 private void InitializePagination(FollowersViewModel followerModel, string route, string userName, int page)
 {
     var paginator = new PaginationInitializer("userPageFollowers", "follower-grid", userName, GetPageSize());
     paginator.InitializePaginationModel(followerModel, page, _usersService.GetFollowingCount(userName));
 }
Example #4
0
 public FollowersViewModel GetFollowingUsersViewModel(string userName, int page)
 {
     var followersForPage = GetPageFor(GetFollowingUsersQuery(userName), page);
     var followersModel = InitializeFollowersViewModel(userName, followersForPage);
     var paginator = new PaginationInitializer("userPageFollowing", "follower-grid", userName, _pageSize);
     paginator.InitializePaginationModel(followersModel, page, GetFollowerCount(userName));
     return followersModel;
 }
Example #5
0
 public AnswerListProfileViewModel GetLikedAnswerListProfileModel(string userName, int page)
 {
     var answersService = new AnswersService(_context, _pageSize);
     var user = GetUserWithName(userName);
     if (user == null)
     {
         return null;
     }
     else
     {
         var answersQuery = _context.AnswerLikes.Where(like => like.Active && like.ApplicationUserId == user.Id).OrderByDescending(like => like.TimeStamp).Select(like => like.Answer);
         var paginationInitializer = new PaginationInitializer("AnswersLikedPage", "answers-list", userName, _pageSize);
         var model = answersService.GetAnswerListProfileModelForQuery(userName, page, answersQuery);
         paginationInitializer.InitializePaginationModel(model.AnswerList, page, answersQuery.Count());
         return model;
     }
 }