Exemplo n.º 1
0
        public ActionResult Index()
        {
            var model = new FAQViewModel()
            {
                FAQ= faqd.Get().ToList().Where(a=>a.isdel==0).OrderBy(a=>a.sort)
            };

            return View(model);
        }
        public ActionResult Edit(int num)
        {
            if (!CheckMemberlogin)
            {
                return RedirectToAction("login", "admin");
            }
            else
            {
                leftModel();
                var model = new FAQViewModel()
                {
                    FAQ = faqd.Get().ToList().Where(a => a.num == num && a.isdel == 0)
                };

                return View(model);
            }
        }
        public ActionResult Read(int page = 1)
        {
            if (!CheckMemberlogin)
            {
                return RedirectToAction("login", "admin");
            }
            else
            {
                leftModel();
                var currentpage = page < 1 ? 1 : page;
                var pagesize = 10;
                var faq = faqd.Get().ToList().Where(a => a.isdel == 0).OrderBy(a => a.sort).OrderByDescending(a => a.udate).ThenByDescending(a => a.num);
                var model = new FAQViewModel()
                {
                    FAQ_pagelist = faq.ToPagedList(currentpage, pagesize)

                };

                return View(model);
            }
        }