コード例 #1
0
        // GET: Roles/Edit/5
        public async Task <IActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var role = await _context.Role.FindAsync(id);

            if (role == null)
            {
                return(NotFound());
            }

            RoleViewModel roleViewModel = new RoleViewModel();

            roleViewModel.Permissions = _rbac.GetRolePermissions(role);
            Form form = Form();

            BindObject.CopyModel(roleViewModel, role);
            form.Model(roleViewModel, "ID");
            ViewData["form"]   = form.GetContent();
            ViewData["script"] = form.GetScript();
            return(View());
        }