Ejemplo n.º 1
0
        public ActionResult Permission(int?id)
        {
            var fun    = FunctionRepository.GetChild(0);
            var lstfun = new List <FunctionInfo>();

            foreach (var info in fun)
            {
                lstfun.Add(info);
                Function_Bind(lstfun, info.FunctionID, "");
            }
            var model = new PermissionModel
            {
                Functions = lstfun,
                Roles     = new SelectList(RoleRepository.GetAll(), "RoleID", "Name")
            };

            if (id != null)
            {
                model.SelectedRoleID    = id.Value;
                model.FunctionsSelected = FunctionRepository.GetApprovedForRole(id.Value);
            }
            return(View(model));
        }