public void MoveItem(ContainablePart item, ContainerPart targetContainer, int?position = null) { var commonPart = item.As <CommonPart>(); if (commonPart == null) { throw new ArgumentException("Cannot move content that have no CommonPart", "item"); } var previousContainer = commonPart.Container != null?commonPart.Container.As <ContainerPart>() : default(ContainerPart); commonPart.Container = targetContainer; if (previousContainer != null && previousContainer.Id != targetContainer.Id) { UpdateItemCount(previousContainer); } if (position != null) { item.Position = position.Value; } UpdateItemCount(targetContainer); UpdateItemPath(item.ContentItem); }
private void UpdateItemCount(ContainablePart part) { var commonPart = part.As<CommonPart>(); if (commonPart == null || commonPart.Container == null) return; var containerPart = commonPart.Container.As<ContainerPart>(); if (containerPart == null) return; _containerService.UpdateItemCount(containerPart); }
private void UpdateItemCount(ContainablePart part) { var commonPart = part.As <CommonPart>(); if (commonPart == null || commonPart.Container == null) { return; } var containerPart = commonPart.Container.As <ContainerPart>(); if (containerPart == null) { return; } _containerService.UpdateItemCount(containerPart); }