/// <summary> /// Maps a <see cref="EntityCollectionDisplay"/> to an <see cref="IEntityCollection"/>. /// </summary> /// <param name="display"> /// The display. /// </param> /// <param name="destination"> /// The destination. /// </param> /// <returns> /// The <see cref="IEntityCollection"/>. /// </returns> public static IEntityCollection ToEntityCollection( this EntityCollectionDisplay display, IEntityCollection destination) { if (!Guid.Empty.Equals(display.Key)) { destination.Key = display.Key; } destination.Name = display.Name; destination.ProviderKey = display.ProviderKey; destination.EntityTfKey = display.EntityTfKey; destination.ParentKey = display.ParentKey.GetValueOrDefault(); ((EntityCollection)destination).SortOrder = display.SortOrder; return(destination); }
public EntityCollectionDisplay PostAddEntityCollection(EntityCollectionDisplay collection) { var ec = _entityCollectionService.CreateEntityCollection( collection.EntityType, collection.ProviderKey, collection.Name); if (collection.ParentKey != null) { ec.ParentKey = collection.ParentKey; } _entityCollectionService.Save(ec); return ec.ToEntityCollectionDisplay(); }
public EntityCollectionDisplay PutEntityCollection(EntityCollectionDisplay collection) { var destination = _entityCollectionService.GetByKey(collection.Key); if (destination == null) throw new NullReferenceException("Collection was not found"); destination = collection.ToEntityCollection(destination); _entityCollectionService.Save(destination); return destination.ToEntityCollectionDisplay(); }
public EntityCollectionDisplay PostAddEntityCollection(EntityCollectionDisplay collection) { var ec = _entityCollectionService.CreateEntityCollection( collection.EntityType, collection.ProviderKey, collection.Name); if (collection.ParentKey != null) { ec.ParentKey = collection.ParentKey; } ec.IsFilter = collection.IsFilter; ((EntityCollection)ec).ExtendedData = collection.ExtendedData.AsExtendedDataCollection(); _entityCollectionService.Save(ec); return ec.ToEntityCollectionDisplay(); }