public async Task<IActionResult> Create([Bind("HandlerMethodSignature,TypeFullName,IdentificationKey,AuthorizationRuleConfigJson,Id,Remark,OrderNumber,RowVersion,IsEnable,IsDeleted,CreationTime,LastModificationTime,CreatorId,LastModificationUserId")] AuthorizationRule requestAuthorizationRule)
 {
     if (ModelState.IsValid)
     {
         _context.Add(requestAuthorizationRule);
         await _context.SaveChangesAsync();
         return RedirectToAction(nameof(Index));
     }
     return View(requestAuthorizationRule);
 }
        public async Task <IActionResult> Create([Bind("AuthorizationRuleConfigJson,Id,Remark,OrderNumber,RowVersion,IsEnable,IsDeleted,CreationTime,LastModificationTime,CreatorId,LastModificationUserId")] AuthorizationRule authorizationRule)
        {
            if (ModelState.IsValid)
            {
                _permissionDbContext.Add(authorizationRule);
                await _permissionDbContext.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CreatorId"] = new SelectList(_identitycontext.Users, "Id", "Id", authorizationRule.CreatorId);
            return(View(authorizationRule));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("RoleId,PermissionValue,PermissionDefinitionId,Id,Remark,OrderNumber,RowVersion,IsEnable,IsDeleted,CreationTime,LastModificationTime,CreatorId,LastModificationUserId")] RolePermissionDeclaration rolePermissionDeclaration)
        {
            if (ModelState.IsValid)
            {
                _permissionDbContext.Add(rolePermissionDeclaration);
                await _permissionDbContext.SaveChangesAsync();

                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> Create([Bind("Name,Description,ValueType,Remark,IsEnable,IsDeleted")] PermissionDefinition permissionDefinition)
        {
            if (ModelState.IsValid)
            {
                permissionDefinition.CreatorId = int.Parse(User.GetSubjectId());
                _permissionDbContext.Add(permissionDefinition);
                await _permissionDbContext.SaveChangesAsync();

                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));
        }