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