| | |
| | | using System.Text; |
| | | |
| | | namespace HStation.Service |
| | | namespace HStation.Service |
| | | { |
| | | public partial class AssetsValveMain |
| | | { |
| | |
| | | if (entity == null) |
| | | return default; |
| | | var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Entity.AssetsValveMain, Model.AssetsValveMain>() |
| | | .ForMember(d => d.KeyWord, opt => opt.MapFrom(src => ToList(src.KeyWord))) |
| | | .ForMember(d => d.KeyWord, opt => opt.MapFrom(src => KeyWordHelper.ToList(src.KeyWord))) |
| | | ).CreateMapper(); |
| | | var model = mapper.Map<Entity.AssetsValveMain, Model.AssetsValveMain>(entity); |
| | | return model; |
| | |
| | | if (entities == null || entities.Count < 1) |
| | | return default; |
| | | var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Entity.AssetsValveMain, Model.AssetsValveMain>() |
| | | .ForMember(d => d.KeyWord, opt => opt.MapFrom(src => ToList(src.KeyWord))) |
| | | .ForMember(d => d.KeyWord, opt => opt.MapFrom(src => KeyWordHelper.ToList(src.KeyWord))) |
| | | ).CreateMapper(); |
| | | var models = mapper.Map<List<Entity.AssetsValveMain>, List<Model.AssetsValveMain>>(entities); |
| | | return models; |
| | |
| | | if (model == null) |
| | | return default; |
| | | var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Model.AssetsValveMain, Entity.AssetsValveMain>() |
| | | .ForMember(d => d.KeyWord, opt => opt.MapFrom(src => ToString(src.KeyWord))) |
| | | .ForMember(d => d.KeyWord, opt => opt.MapFrom(src => KeyWordHelper.ToString(src.KeyWord))) |
| | | ).CreateMapper(); |
| | | var entity = mapper.Map<Model.AssetsValveMain, Entity.AssetsValveMain>(model); |
| | | return entity; |
| | |
| | | if (models == null || models.Count < 1) |
| | | return default; |
| | | var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Model.AssetsValveMain, Entity.AssetsValveMain>() |
| | | .ForMember(d => d.KeyWord, opt => opt.MapFrom(src => ToString(src.KeyWord))) |
| | | .ForMember(d => d.KeyWord, opt => opt.MapFrom(src => KeyWordHelper.ToString(src.KeyWord))) |
| | | |
| | | ).CreateMapper(); |
| | | var entities = mapper.Map<List<Model.AssetsValveMain>, List<Entity.AssetsValveMain>>(models); |
| | |
| | | if (model == null || entity == null) |
| | | return; |
| | | var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Model.AssetsValveMain, Entity.AssetsValveMain>() |
| | | .ForMember(d => d.KeyWord, opt => opt.MapFrom(src => ToString(src.KeyWord))) |
| | | .ForMember(d => d.KeyWord, opt => opt.MapFrom(src => KeyWordHelper.ToString(src.KeyWord))) |
| | | ).CreateMapper(); |
| | | mapper.Map(model, entity); |
| | | } |
| | | |
| | | public static List<string> ToList(string keyword) |
| | | { |
| | | if (string.IsNullOrEmpty(keyword)) |
| | | { |
| | | return new List<string>(); |
| | | } |
| | | |
| | | return keyword.Split(new string[1] { "," }, StringSplitOptions.RemoveEmptyEntries).ToList(); |
| | | } |
| | | |
| | | public static string ToString(List<string> KeyWord) |
| | | { |
| | | if (KeyWord == null || KeyWord.Count < 1) |
| | | { |
| | | return string.Empty; |
| | | } |
| | | |
| | | return string.Join(",", KeyWord); |
| | | } |
| | | } |
| | | } |