protected PickerTargetingGroupModel SerializePickerGroup(Picker.TargetingGroupModel model) { var baskets = this.SerializeBaskets(model.GetBaskets()); var result = new PickerTargetingGroupModel(model.TargetingGroupId, model.TargetingGroupName, baskets); return(result); }
public void Serialize(TargetingGroupModel group, IJsonWriter writer) { writer.Write(group.TargetingGroupId, "id"); writer.Write(group.TargetingGroupName, "name"); writer.WriteArray(group.GetBaskets(), "baskets", basket => { writer.Write(delegate { this.Serialize(basket, writer); }); }); }
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); }