using AutoMapper; using System.Collections.Generic; using System.Linq; namespace TProduct.BLL { public partial class TestProjectItemBundle { #region TestProjectItemMap //Entity to Model internal static TProduct.Model.TestProjectItemBundle Entity2Model(TProduct.Entity.TestProjectItemBundle entity) { if (entity == null) return default; var mapper = new MapperConfiguration(cfg => cfg.CreateMap()).CreateMapper(); var model = mapper.Map(entity); return model; } //Entities to Models internal static List Entity2Models(List entities) { if (entities == null || entities.Count() < 1) return default; var mapper = new MapperConfiguration(cfg => cfg.CreateMap()).CreateMapper(); var models = mapper.Map, List>(entities); return models; } //Model to Entity internal static TProduct.Entity.TestProjectItemBundle Model2Entity(TProduct.Model.TestProjectItemBundle model) { if (model == null) return default; var mapper = new MapperConfiguration(cfg => cfg.CreateMap()).CreateMapper(); var entity = mapper.Map(model); return entity; } //Models to Entities internal static List Model2Entities(List models) { if (models == null || models.Count < 1) return default; var mapper = new MapperConfiguration(cfg => cfg.CreateMap()).CreateMapper(); var entities = mapper.Map, List>(models); return entities; } //Model to Entity internal static void Model2Entity(TProduct.Model.TestProjectItemBundle model, TProduct.Entity.TestProjectItemBundle entity) { if (model == null || entity == null) return; var mapper = new MapperConfiguration(cfg => cfg.CreateMap()).CreateMapper(); mapper.Map(model, entity); } #endregion } }