| | |
| | | using System; |
| | | using AutoMapper; |
| | | using IStation.Untity; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.IO; |
| | | using System.Linq; |
| | |
| | | return default; |
| | | |
| | | |
| | | return JsonHelper.Json2Object<List<Model.Product>>(str); |
| | | return Entity2Models(JsonHelper.Json2Object<List<Entity.Product>>(str)); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | private static List<Model.Product> Entity2Models(List<Entity.Product> entities) |
| | | { |
| | | if (entities == null || entities.Count() < 1) |
| | | return default; |
| | | var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Entity.Product, Model.Product>() |
| | | .ForMember(d => d.ParentIds, opt => opt.MapFrom(src => TreeParentIdsHelper.ToList(src.ParentIds))) |
| | | .ForMember(d => d.Flags, opt => opt.MapFrom(src => FlagsHelper.ToList(src.Flags))) |
| | | ).CreateMapper(); |
| | | var models = mapper.Map<List<Entity.Product>, List<Model.Product>>(entities); |
| | | return models; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |