Exemplo n.º 1
0
        /// <summary>
        /// List the latest questions, their votes and the number of answers for them
        /// </summary>
        /// <returns></returns>
        public ActionResult IndexQuestions()
        {
            List <Question> question = QuestionManager.GetXLatestQuestion(10);

            //Create the viewmodel from the questions
            List <QuestionIndexModel> qim = MyHelpers.ToQuestionIndexModel(question);


            return(PartialView("_ShowQuestions", qim));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Displays the questions which contains one of the favorite tags of the user
        /// </summary>
        /// <param name="userid">User Id</param>
        /// <returns></returns>
        public ActionResult QuestionsToUser()
        {
            ViewBag.QuestionTitle = Resources.Global.LatestUnansweredQuestionsWithYourFavoriteSpeciality;
            var questions = QuestionManager.GetQuestionsFitToUser(WebSecurity.CurrentUserId);

            if (questions.Count == 0)
            {
                return(new EmptyResult());
            }
            else
            {
                return(PartialView("_ShowQuestions", MyHelpers.ToQuestionIndexModel(QuestionManager.GetQuestionsFitToUser(WebSecurity.CurrentUserId))));
            }
        }
Exemplo n.º 3
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));
        }
Exemplo n.º 4
0
 /// <summary>
 /// Lists the questions which contains the given tag
 /// </summary>
 /// <param name="page">Page number</param>
 /// <param name="questions">Questions</param>
 /// <returns></returns>
 public ActionResult GetQuestionsByTag(int page, IPagedList <Question> questions)
 {
     return(PartialView("_ShowQuestions", MyHelpers.ToQuestionIndexModel(questions)));
 }