Exemplo n.º 1
0
        public JsonResult GetRightList(KendoTreeviewParamViewModel model)
        {
            var rightList = new List<KendoTreeviewViewModel>();

            if (model.ApplicationId == null && model.ModuleId == null)
            {
                rightList = _rightRepository.GetAll().Select(x => new KendoTreeviewViewModel { Id = x.RightId.ToString(), Text = x.RightName, IsChecked = Boolean.FalseString, ParentId = null }).ToList();
            }
            else
            {
                rightList = _rightRepository.GetAll().Where(x => x.ApplicationId == Convert.ToInt32(model.ApplicationId) && x.ModuleId == Convert.ToInt32(model.ModuleId)).Select(x => new KendoTreeviewViewModel { Id = x.RightId.ToString(), Text = x.RightName, IsChecked = Boolean.FalseString, ParentId = null }).ToList();
            }

            return Json(rightList, JsonRequestBehavior.AllowGet);
        }
Exemplo n.º 2
0
        public JsonResult GetMenuList(KendoTreeviewParamViewModel model)
        {
            var menuList = new List<KendoTreeviewViewModel>();

            var commonChildList = new List<KendoTreeviewViewModel>()
                                                {
                                                    new KendoTreeviewViewModel { Id = "1", Text = "Add", IsChecked = Boolean.FalseString, ParentId = "1" },
                                                    new KendoTreeviewViewModel { Id = "2", Text = "Edit", IsChecked = Boolean.FalseString, ParentId = "1" },
                                                    new KendoTreeviewViewModel { Id = "3", Text = "Delete", IsChecked = Boolean.FalseString, ParentId = "1" },
                                                   new KendoTreeviewViewModel { Id = "4", Text = "Cancel", IsChecked = Boolean.FalseString, ParentId = "1" },
                                                    new KendoTreeviewViewModel { Id = "5", Text = "Print", IsChecked = Boolean.FalseString, ParentId = "1" }
                                                };

            if (model.ApplicationId == null && model.ModuleId == null)
            {
                menuList = _menuRepository.GetAll().Select(x => new KendoTreeviewViewModel { Id = x.MenuId.ToString(), Text = x.MenuName, IsChecked = Boolean.FalseString, ParentId = null, Items = commonChildList }).ToList();
            }
            else
            {
                menuList = _menuRepository.GetAll().Where(x => x.ApplicationId == Convert.ToInt32(model.ApplicationId) && x.ModuleId == Convert.ToInt32(model.ModuleId)).Select(x => new KendoTreeviewViewModel { Id = x.MenuId.ToString(), Text = x.MenuName, IsChecked = Boolean.FalseString, ParentId = null, Items = commonChildList }).ToList();
            }

            return Json(menuList, JsonRequestBehavior.AllowGet);
        }