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; }
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; }
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)); }
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; }
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; } }