Ejemplo n.º 1
0
        public ActionResult Permission(int id)
        {
            var lstOrder     = new List <AdminMenu>();
            var lstAdminMenu = _adminMenuRepository.GetAll().ToList();
            var lstParents   = lstAdminMenu.Where(g => g.ParentID == 0).OrderBy(g => g.Ordering).ToList();

            foreach (var tblAdminMenu in lstParents)
            {
                lstOrder.Add(tblAdminMenu);
                var lstChild = lstAdminMenu.Where(g => g.ParentID == tblAdminMenu.ID).OrderBy(g => g.Ordering).ToList();
                if (lstChild.Count > 0)
                {
                    lstOrder.AddRange(lstChild);
                }
            }
            lstOrder = Common.CreateLevel(lstOrder);
            TempData["GroupUser"] = _groupUserRepository.Find(id);
            return(Json(RenderViewToString("~/Areas/Admin/Views/GroupUser/_Permission.cshtml", lstOrder),
                        JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 2
0
        public ActionResult ListData(int page = 1)
        {
            var lstAdminMenu = _adminMenuRepository.GetAll();

            foreach (var item in lstAdminMenu)
            {
                var objParent = lstAdminMenu.FirstOrDefault(g => g.ID == item.ParentID);
                if (objParent != null)
                {
                    item.ParentName = objParent.Name;
                }
            }
            var lstLevel = Common.CreateLevel(lstAdminMenu.ToList());

            return(Json(new
            {
                viewContent = RenderViewToString("~/Areas/Admin/Views/AdminMenu/_ListData.cshtml", lstLevel),
            }, JsonRequestBehavior.AllowGet));
        }