コード例 #1
0
 public async Task CreateOperation(Permission operation, IEnumerable <long> functionIds)
 {
     await UnitOfWorkAsync(async (conn, trans) => {
         var permissionId = await _permissionRepository.InsertAndGetIdAsync(operation, conn, trans);
         foreach (var funcId in functionIds)
         {
             var permissionFunc = new PermissionFunction()
             {
                 FunctionId   = funcId,
                 PermissionId = permissionId,
             };
             await _permissionFunctionRepository.InsertAsync(permissionFunc, conn, trans);
         }
     }, Connection);
 }
コード例 #2
0
 public async Task UpdateOperation(Permission operation, IEnumerable <long> functionIds)
 {
     await UnitOfWorkAsync(async (conn, trans) => {
         await _permissionRepository.UpdateAsync(operation, conn, trans);
         await _permissionFunctionRepository.DeleteAsync(p => p.PermissionId == operation.Id, conn, trans);
         foreach (var funcId in functionIds)
         {
             var permissionFunc = new PermissionFunction()
             {
                 FunctionId   = funcId,
                 PermissionId = operation.Id,
             };
             await _permissionFunctionRepository.InsertAsync(permissionFunc, conn, trans);
         }
     }, Connection);
 }