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