コード例 #1
0
ファイル: Serializer.cs プロジェクト: leewashmore/Greenfield
        protected PickerTargetingGroupModel SerializePickerGroup(Picker.TargetingGroupModel model)
        {
            var baskets = this.SerializeBaskets(model.GetBaskets());
            var result  = new PickerTargetingGroupModel(model.TargetingGroupId, model.TargetingGroupName, baskets);

            return(result);
        }
コード例 #2
0
 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);
         });
     });
 }
コード例 #3
0
        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);
        }