Пример #1
0
        public async Task <IActionResult> Edit(int permissionDefinitionId, [Bind("RoleId,PermissionValue,PermissionDefinitionId,Id,Remark,OrderNumber,RowVersion,IsEnable,IsDeleted,CreationTime,LastModificationTime,CreatorId,LastModificationUserId")] RolePermissionDeclaration rolePermissionDeclaration)
        {
            if (permissionDefinitionId != rolePermissionDeclaration.PermissionDefinitionId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _permissionDbContext.Update(rolePermissionDeclaration);
                    await _permissionDbContext.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RolePermissionDeclarationExists(rolePermissionDeclaration.PermissionDefinitionId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PermissionDefinition"] = new SelectList(_permissionDbContext.PermissionDefinitions, "Id", "Name", rolePermissionDeclaration.PermissionDefinitionId);
            ViewData["Role"] = new SelectList(_identityDbContext.Roles, "Id", "Name", rolePermissionDeclaration.RoleId);
            return(View(rolePermissionDeclaration));
        }
        public async Task <IActionResult> Edit(int id, [Bind("AuthorizationRuleConfigJson,Id,Remark,OrderNumber,RowVersion,IsEnable,IsDeleted,CreationTime,LastModificationTime,CreatorId,LastModificationUserId")] AuthorizationRule authorizationRule)
        {
            if (id != authorizationRule.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _permissionDbContext.Update(authorizationRule);
                    await _permissionDbContext.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AuthorizationRuleExists(authorizationRule.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CreatorId"] = new SelectList(_identitycontext.Users, "Id", "Id", authorizationRule.CreatorId);
            return(View(authorizationRule));
        }
        public async Task<IActionResult> Edit(int id, [Bind("HandlerMethodSignature,TypeFullName,IdentificationKey,AuthorizationRuleConfigJson,Id,Remark,OrderNumber,RowVersion,IsEnable,IsDeleted,CreationTime,LastModificationTime,CreatorId,LastModificationUserId")] AuthorizationRule requestAuthorizationRule)
        {
            if (id != requestAuthorizationRule.Id)
            {
                return NotFound();
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(requestAuthorizationRule);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RequestAuthorizationRuleExists(requestAuthorizationRule.Id))
                    {
                        return NotFound();
                    }
                    else
                    {
                        throw;
                    }
                }
                return RedirectToAction(nameof(Index));
            }
            return View(requestAuthorizationRule);
        }
        public async Task <IActionResult> Edit(int id, [Bind("Name,Description,ValueType,Id,Remark,RowVersion,IsEnable")] PermissionDefinition permissionDefinition)
        {
            if (id != permissionDefinition.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _permissionDbContext.Update(permissionDefinition);
                    await _permissionDbContext.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PermissionDefinitionExists(permissionDefinition.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            //ViewData["CreatorId"] = new SelectList(_context.Users, "Id", "Id", permissionDefinition.CreatorId);
            //ViewData["LastModificationUserId"] = new SelectList(_context.Users, "Id", "Id", permissionDefinition.LastModificationUserId);
            return(View(permissionDefinition));
        }