public TargetingTypeGroupModel SerializeTargetingTypeGroup(TargetingTypeGroup model) { var result = new TargetingTypeGroupModel( model.Id, model.Name, model.BenchmarkIdOpt, this.SerializeTargetingTypes(model.GetTargetingTypes()) ); return(result); }
public TargetingGroupModel TransformToGroup(TargetingTypeGroup groupModel, IEnumerable <UsernameBasketInfo> baskets) { var result = new TargetingGroupModel( groupModel.Id, groupModel.Name, groupModel.GetTargetingTypes() .SelectMany(x => this.basketExtractor.ExtractBaskets(x)) .GroupBy(x => x.Id) // getting rid of the same baskets .Select(x => new BasketModel(x.Key, this.basketRenderer.RenderBasketOnceResolved(x.First()))), baskets); return(result); }
public IEnumerable <IBasket> ExtractBaskets(TargetingTypeGroup targetingTypeGroup) { return(targetingTypeGroup.GetTargetingTypes().SelectMany(x => this.ExtractBaskets(x)).Distinct()); }