Esempio n. 1
0
        /// <summary>
        /// Shows the page of a tag
        /// </summary>
        /// <param name="id">Tag id</param>
        /// <param name="page">Page number</param>
        /// <returns></returns>
        public ActionResult Tag(int id, int?page)
        {
            var actpage = page ?? 1;
            int total;
            var allresult = QuestionManager.AllQuestionToOneTagToPagedList(id, actpage, 10, out total);

            //Viewbag objects
            ViewBag.OnePageOfProducts = new StaticPagedList <Question>(allresult, actpage, 10, total);
            ViewBag.Page     = actpage;
            ViewBag.Tag      = TagManager.GetTagById(id);
            ViewBag.MorePage = total - allresult.Count();

            return(View());
        }
Esempio n. 2
0
        /// <summary>
        /// Lists the tags
        /// </summary>
        /// <returns></returns>
        public ActionResult ListAllTags()
        {
            //Manager classes
            var tags = TagManager.GetAllTag();
            //We list the tags
            var retlist = new List <TagListModel>();

            foreach (var item in tags)
            {
                var add = new TagListModel();
                add.Tag = item;
                int count;
                QuestionManager.AllQuestionToOneTagToPagedList(item.Id, 1, 1, out count);
                add.Questions     = count;
                add.SubcribedUser = UserManager.AllSubcribeUsersCountToOneTag(item.Id);
                retlist.Add(add);
            }



            return(View(retlist.OrderByDescending(q => q.Questions).ToList()));
        }