Example #1
0
        public async Task <IActionResult> Index()
        {
            var tags = await _tagService.GetAllAsync();

            var model = new TagsPageViewModel()
            {
                Tags = _mapper.Map <List <TagViewModel> >(tags.OrderBy(t => t.Name))
            };

            return(View(model));
        }
Example #2
0
        public ActionResult Tags(string tab = Constant.Question.String.TagPopularTab, int page = 0)
        {
            int        skip = page * Constant.Question.Integer.TagPagingDefaultTake;
            List <Tag> tags = cService.GetTags(skip, tab);

            if (page == 0)
            {
                TagsPageViewModel model = new TagsPageViewModel();
                model.Tab      = tab;
                model.ListTags = tags;
                ViewBag.System = Constant.String.QuestionSystem;
                ViewBag.Tab    = Constant.Question.String.HomeTagTab;
                var cookie = new HttpCookie("returnUrl", Request.Url.AbsolutePath + Request.Url.Query);
                cookie.Expires = DateTime.Now.AddMinutes(5);
                Response.Cookies.Add(cookie);
                return(View("Views/TagsPageView", model));
            }
            else
            {
                return(PartialView("Partials/_TagListPartialView", tags));
            }
        }