示例#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;
 }
示例#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;
 }
示例#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));
 }
示例#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;
 }
示例#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;
     }
 }