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