public virtual async Task MoveAsync(Guid id, OrganizationUnitMoveInput input)
        {
            var ou = await OrganizationUnitRepository.GetAsync(id, false);

            await AuthorizationService.CheckAsync(ou, CommonOperations.Update);

            if (input.ParentId != ou.ParentId)
            {
                if (input.ParentId.HasValue)
                {
                    var parentOrganizationUnit = await OrganizationUnitRepository.GetAsync(input.ParentId.Value, false);

                    await AuthorizationService.CheckAsync(parentOrganizationUnit, CommonOperations.Create);
                }
                else
                {
                    await AuthorizationService.CheckAsync(null, CommonOperations.Create);
                }
            }

            await OrganizationUnitManager.MoveAsync(ou.Id, input.ParentId);

            var children = await OrganizationUnitRepository.GetChildrenAsync(input.ParentId, false);

            await UpdatePositionAsync(ou, children, input.BeforeOrganizationUnitId);
        }
示例#2
0
 public async Task MoveAsync(Guid id, OrganizationUnitMoveInput input)
 {
     await _organizationUnitAppService.MoveAsync(id, input);
 }