Esempio n. 1
0
        /// <summary>
        /// Shows the asked 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>
        /// <returns></returns>
        public ActionResult GetAskedQuestionsByUser(int id, int askedquestionpage, int answeredquestionpage)
        {
            //Get the questions for the actual page
            int totalquestions;
            var retrievedQuestions = QuestionManager.AllQuestionToOneUserToPagedList(id, askedquestionpage, 10, out totalquestions);
            //Convert it to a StaticPagedList for the pager
            var actualQuestions = new StaticPagedList <Question>(retrievedQuestions, askedquestionpage, 10, totalquestions);

            var questionIndexModels = MyHelpers.ToQuestionIndexModel(actualQuestions);

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

            return(PartialView("_ShowAskedQuestions", questionIndexModels));
        }