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