Beispiel #1
0
        public void SaveExisting(IItem item)
        {
            if (item == null)
            {
                throw new ArgumentNullException(nameof(item));
            }

            var actualItem = item as DefaultItem;

            if (actualItem == null)
            {
                throw new ArgumentException($"Unknown item type: '{item.GetType().Name}'", nameof(item));
            }

            try
            {
                provider.Update(actualItem.Type.Name, actualItem.GetEntity());

                if (item.Children.Count > 0)
                {
                    saveChildren(item);
                }
            }
            catch (EntitityNotFoundException e)
            {
                throw new ItemNotFoundException(item, e);
            }
        }