コード例 #1
0
        public ActionResult ListData(string keyWord, int pageIndex, int pageSize)
        {
            var lstObj = _instructionRepository.GetAll().ToList();

            if (!string.IsNullOrEmpty(keyWord))
            {
                lstObj = lstObj.Where(x => HelperString.UnsignCharacter(x.Title.ToLower().Trim()).Contains(HelperString.UnsignCharacter(keyWord.ToLower().Trim()))).ToList();
            }
            var totalRow = lstObj.Count();

            TempData["Page"] = pageIndex;
            lstObj           = lstObj.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList();
            return(Json(new
            {
                viewContent = RenderViewToString("~/Areas/Admin/Views/Instruction/_ListData.cshtml", lstObj),
                totalPages = Math.Ceiling(((double)totalRow / pageSize))
            }, JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
        public ActionResult Detail(string linkseo)
        {
            var obj = _instructionRepository.GetAll().FirstOrDefault(x => x.LinkSeo.Equals(linkseo));

            return(View(obj));
        }