public ActionResult Search(AdminMenu obj)
        {
            var lstAdminMenu = _adminMenuRepository.GetAll().ToList();

            if (!string.IsNullOrEmpty(obj.Name))
            {
                lstAdminMenu =
                    lstAdminMenu.Where(
                        g =>
                        HelperString.UnsignCharacter(g.Name.Trim().ToLower()).Contains(HelperString.UnsignCharacter(obj.Name.ToLower().Trim()))).ToList();
                foreach (var cat in lstAdminMenu)
                {
                    AddParent(cat, lstAdminMenu, _adminMenuRepository.GetAll().ToList());
                }
                lstAdminMenu.AddRange(_lstOtherAdminMenus);
            }
            foreach (var item in lstAdminMenu)
            {
                var objParent = lstAdminMenu.FirstOrDefault(g => g.ID == item.ParentID);
                if (objParent != null)
                {
                    item.Name = objParent.Name;
                }
            }
            var lstLevel = Common.CreateLevel(lstAdminMenu.ToList());

            return(Json(new
            {
                viewContent = RenderViewToString("~/Areas/Admin/Views/AdminMenu/_ListData.cshtml", lstLevel),
            }, JsonRequestBehavior.AllowGet));
        }
        public ActionResult ListData(string keyWord, int page = 1)
        {
            var model = _homeMenuRepository.GetAll();
            var lst   = new List <HomeMenu>();

            foreach (var item in model.Where(g => g.ParentId == 0).OrderBy(x => x.Ordering).ToList())
            {
                lst = RenderMenu(item, model.ToList());
            }

            if (!string.IsNullOrEmpty(keyWord))
            {
                lst = lst.Where(x => HelperString.UnsignCharacter(x.Name.ToLower().Trim()).Contains(HelperString.UnsignCharacter(keyWord.ToLower().Trim()))).ToList();
            }

            var totalAdv = lst.Count();

            lst = lst.Skip((page - 1) * 20).Take(20).ToList();
            TempData["Page"] = page;
            return(Json(new
            {
                viewContent = RenderViewToString("~/Areas/Admin/Views/HomeMenu/_ListData.cshtml", lst),
                totalPages = Math.Ceiling(((double)totalAdv / 20)),
            }, JsonRequestBehavior.AllowGet));
        }
Example #3
0
        public ActionResult ListData(string keyWord, int pageIndex, int pageSize)
        {
            Session["PAGE"] = pageIndex;
            int page = Convert.ToInt32(Request.QueryString["page"]);

            if (page > 1)
            {
                pageIndex = page;
            }

            var model = newsRepository.GetAll().ToList();

            if (!string.IsNullOrEmpty(keyWord))
            {
                model = model.Where(x => HelperString.UnsignCharacter(x.MetaTitle.ToLower().Trim()).Contains(HelperString.UnsignCharacter(keyWord.ToLower().Trim()))).ToList();
            }
            var totalAdv = model.Count();

            TempData["Page"] = pageIndex;
            model            = model.Skip((pageIndex - 1) * 10).Take(10).ToList();
            return(Json(new
            {
                viewContent = RenderViewToString("~/Areas/Admin/Views/News/ListData.cshtml", model),
                totalPages = Math.Ceiling(((double)totalAdv / 10)),
            }, JsonRequestBehavior.AllowGet));
        }
Example #4
0
        public ActionResult Search(int?pageIndex, string title)
        {
            int pagesite   = 12;
            int pagenumber = (pageIndex ?? 1);

            var model = productRepository.GetAll();

            if (!string.IsNullOrEmpty(title))
            {
                model = model.Where(x => HelperString.UnsignCharacter(x.Name.ToLower().Trim()).Contains(HelperString.UnsignCharacter(title.ToLower().Trim())));
            }
            model = model.OrderByDescending(x => x.CreatedDate).ToPagedList(pagenumber, pagesite);
            return(View(model));
        }
Example #5
0
        public ActionResult ListData(string Name, string LangCode, int page = 1)
        {
            var lstgallerycategory = _galleryCategoryReporitory.GetAll().OrderByDescending(g => g.ID).ToList();

            if (!string.IsNullOrEmpty(Name))
            {
                lstgallerycategory =
                    lstgallerycategory.Where(
                        g => HelperString.UnsignCharacter(g.Name.ToLower().Trim()).Contains(Name.ToLower().Trim())).ToList();
            }
            return(Json(new
            {
                viewContent = RenderViewToString("~/Areas/Admin/Views/GalleryCategory/_ListData.cshtml", lstgallerycategory),
            }, JsonRequestBehavior.AllowGet));
        }
Example #6
0
        public ActionResult ListData(string Name, int page = 1)
        {
            var lstUser = _userRepository.GetAll().ToList();

            if (!string.IsNullOrEmpty(Name))
            {
                lstUser = lstUser.Where(g => HelperString.UnsignCharacter(g.FullName.Trim().ToLower()).Contains(HelperString.UnsignCharacter(Name.ToLower().Trim())) || HelperString.UnsignCharacter(g.UserName.Trim().ToLower()).Contains(HelperString.UnsignCharacter(Name.ToLower().Trim()))).ToList();
            }
            var lstLevel = lstUser.Skip((page - 1) * Webconfig.RowLimit).Take(Webconfig.RowLimit).ToList();

            TempData["NguoiDung"] = lstUser;
            return(Json(new
            {
                viewContent = RenderViewToString("~/Areas/Admin/Views/Account/_ListData.cshtml", lstLevel),
                totalPages = Math.Ceiling(((double)lstUser.Count / Webconfig.RowLimit)),
            }, JsonRequestBehavior.AllowGet));
        }
Example #7
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));
        }
        public ActionResult Search(tbl_GroupUser obj, int page = 1)
        {
            var lstGroupUser = _groupUserRepository.GetAll();

            if (!string.IsNullOrEmpty(obj.Name))
            {
                lstGroupUser =
                    lstGroupUser.Where(
                        g =>
                        HelperString.UnsignCharacter(g.Name.ToLower().Trim())
                        .Contains(HelperString.UnsignCharacter(obj.Name).ToLower().Trim()));
            }
            var totalRecord = lstGroupUser.Count();

            lstGroupUser =
                lstGroupUser.Skip((page - 1) * Webconfig.RowLimit).Take(Webconfig.RowLimit).ToList();
            return(Json(new
            {
                viewContent = RenderViewToString("~/Areas/Admin/Views/GroupUser/_ListData.cshtml", lstGroupUser),
                totalPages = Math.Ceiling(((double)totalRecord / Webconfig.RowLimit)),
            }, JsonRequestBehavior.AllowGet));
        }