Esempio n. 1
0
        /// <summary>
        /// Shows the answered questions by a user
        /// </summary>
        /// <param name="id">User id</param>
        /// <param name="askedquestionpage">Asked questions page number</param>
        /// <param name="answeredquestionpage">Answered questions page number</param>
        public ActionResult GetAnsweredQuestionsByUser(int id, int askedquestionpage, int answeredquestionpage)
        {
            //Get the questions for the actual page
            int totalquestions;
            var retrievedQuestions = QuestionManager.AnsweredQuestionsToPagedList(id, answeredquestionpage, 5, out totalquestions);
            //Convert it to a StaticPagedList for the pager
            var actualQuestions = new StaticPagedList <Question>(retrievedQuestions, answeredquestionpage, 5, totalquestions);

            var model = MyHelpers.ToGetQuestionModels(actualQuestions, id);

            ViewBag.QuestionsForPager    = actualQuestions;
            ViewBag.AskedQuestionPage    = askedquestionpage;
            ViewBag.AnsweredQuestionPage = answeredquestionpage;
            ViewBag.UserId = id;

            return(PartialView("_ShowAnsweredQuestions", model));
        }