namespace HStation.Service
|
{
|
public partial class AssetsExchangerMainAndPartMapping
|
{
|
//Entity to GetModel
|
internal static Model.AssetsExchangerMainAndPartMap Entity2Model(Entity.AssetsExchangerMainAndPartMapping entity)
|
{
|
if (entity == null)
|
return default;
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Entity.AssetsExchangerMainAndPartMapping, Model.AssetsExchangerMainAndPartMap>()
|
).CreateMapper();
|
var model = mapper.Map<Entity.AssetsExchangerMainAndPartMapping, Model.AssetsExchangerMainAndPartMap>(entity);
|
return model;
|
}
|
|
//Entities to GetModels
|
internal static List<Model.AssetsExchangerMainAndPartMap> Entity2Models(List<Entity.AssetsExchangerMainAndPartMapping> entities)
|
{
|
if (entities == null || entities.Count < 1)
|
return default;
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Entity.AssetsExchangerMainAndPartMapping, Model.AssetsExchangerMainAndPartMap>()
|
).CreateMapper();
|
var models = mapper.Map<List<Entity.AssetsExchangerMainAndPartMapping>, List<Model.AssetsExchangerMainAndPartMap>>(entities);
|
return models;
|
}
|
|
//Model to Entity
|
internal static Entity.AssetsExchangerMainAndPartMapping Model2Entity(Model.AssetsExchangerMainAndPartMap model)
|
{
|
if (model == null)
|
return default;
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Model.AssetsExchangerMainAndPartMap, Entity.AssetsExchangerMainAndPartMapping>()
|
).CreateMapper();
|
var entity = mapper.Map<Model.AssetsExchangerMainAndPartMap, Entity.AssetsExchangerMainAndPartMapping>(model);
|
return entity;
|
}
|
|
//Models to Entities
|
internal static List<Entity.AssetsExchangerMainAndPartMapping> Model2Entities(List<Model.AssetsExchangerMainAndPartMap> models)
|
{
|
if (models == null || models.Count < 1)
|
return default;
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Model.AssetsExchangerMainAndPartMap, Entity.AssetsExchangerMainAndPartMapping>()
|
).CreateMapper();
|
var entities = mapper.Map<List<Model.AssetsExchangerMainAndPartMap>, List<Entity.AssetsExchangerMainAndPartMapping>>(models);
|
return entities;
|
}
|
|
//Model to Entity
|
internal static void Model2Entity(Model.AssetsExchangerMainAndPartMap model, Entity.AssetsExchangerMainAndPartMapping entity)
|
{
|
if (model == null || entity == null)
|
return;
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Model.AssetsExchangerMainAndPartMap, Entity.AssetsExchangerMainAndPartMapping>()
|
).CreateMapper();
|
mapper.Map(model, entity);
|
}
|
}
|
}
|