Exemplo n.º 1
0
        private async Task DeleteLinkAsync(Entity removalSource, Entity removalTarget, string linkTypeId, bool overrideIsRelation = false)
        {
            bool isRelation = _mappingHelper.IsRelation(linkTypeId) || overrideIsRelation;

            LinkType linktype = _config.LinkTypes.Find(lt => lt.Id == linkTypeId);

            if (linktype.SourceEntityTypeId.Equals("ChannelNode") && linktype.TargetEntityTypeId.Equals("Product"))
            {
                isRelation = true;
            }

            string sourceCode = _catalogCodeGenerator.GetEpiserverCode(removalSource);
            string targetCode = _catalogCodeGenerator.GetEpiserverCode(removalTarget);

            await _epiApi.DeleteLinkAsync(sourceCode, targetCode, isRelation);
        }