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