Last active
January 24, 2019 20:48
-
-
Save hartviglarsen/85a439f37349f3e33bd8365f6a71265f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (bodyText.InvariantContains(product.Name)) | |
| { | |
| if (relationService.AreRelated(doc, product, "product") == false) | |
| { | |
| relationService.Relate(doc, product, "product"); | |
| } | |
| } | |
| else | |
| { | |
| if (relationService.AreRelated(doc, product, "product") == true) | |
| { | |
| var type = relationService.GetRelationTypeByAlias("product"); | |
| var relations = relationService.GetAllRelationsByRelationType(type.Id) | |
| .Where(x => x.ParentId == doc.Id && x.ChildId == product.Id); | |
| foreach (var relation in relations) | |
| { | |
| relationService.Delete(relation); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment