예제 #1
0
        public async Task <IActionResult> GetUserSelfQuestionsAsync(string userName, int index)
        {
            if (index <= 0)
            {
                index = 1;
            }

            Domain.Clients.User user = Domain.Clients.Hub.GetUserByUserName(userName);

            Paginator pager = Paginator.New(index, 10, 2);

            pager["userId"]        = user.Id.ToString();
            pager["currentUserId"] = CurrentUser.Id.ToString();

            Paginator resultPager = await user.GetSelfQuestionsAsync(pager);

            ViewModels.Users.UserQuestions model = new ViewModels.Users.UserQuestions
            {
                UserIntro = new ViewModels.Shared.UserIntro
                {
                    UserName = userName,
                    Avatar   = user.GetAvatar()
                },
                Paginator = resultPager
            };

            return(View("questions", model));
        }
예제 #2
0
        public async Task <IActionResult> GetUserSelfAnswerAsync(string userName, int index)
        {
            Domain.Clients.User user = Domain.Clients.Hub.GetUserByUserName(userName);

            Paginator pager = Paginator.New(index, 10, 3);

            pager["userId"]        = user.Id.ToString();
            pager["currentUserId"] = CurrentUser.Id.ToString();
            pager["questionTitle"] = "";

            Paginator resultPager = await user.GetSelfAnswersByDetailAsync(pager);

            ViewModels.Users.UserAnswers model = new ViewModels.Users.UserAnswers
            {
                UserIntro = new ViewModels.Shared.UserIntro
                {
                    UserName = userName,
                    Avatar   = user.GetAvatar()
                },
                Paginator = resultPager
            };
            return(View("answers", model));
        }