public IPromotionTree DecomposePromotionTree(SerializablePromotionTreeData treeData) { var treeTemplate = AvailableTemplates.Where(template => template.name.Equals(treeData.Template)).First(); var chosenPromotions = AvailablePromotions.Where(promotion => treeData.ChosenPromotions.Contains(promotion.name)); return(new PromotionTree(treeTemplate, chosenPromotions)); }
public SerializablePromotionTreeData ComposePromotionTree(IPromotionTree promotionTree) { var newTreeData = new SerializablePromotionTreeData(); newTreeData.Template = promotionTree.Template.name; newTreeData.ChosenPromotions = new List <string>( promotionTree.GetChosenPromotions().Select(promotion => promotion.name) ); return(newTreeData); }