namespace ISupply.BLL
|
{
|
public static class TreeSorter_Instance
|
{
|
//Entity to GetModel
|
public static Yw.Model.TreeSorter Entity2Model(this Yw.Entity.TreeSorter entities)
|
{
|
if (entities == null)
|
return default;
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Yw.Entity.TreeSorter, Yw.Model.TreeSorter>()
|
).CreateMapper();
|
var model = mapper.Map<Yw.Entity.TreeSorter, Yw.Model.TreeSorter>(entities);
|
return model;
|
}
|
|
//Entities to GetModels
|
public static List<Yw.Model.TreeSorter> Entity2Models(this List<Yw.Entity.TreeSorter> entities)
|
{
|
if (entities == null || entities.Count() < 1)
|
return default;
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Yw.Entity.TreeSorter, Yw.Model.TreeSorter>()
|
).CreateMapper();
|
var models = mapper.Map<List<Yw.Entity.TreeSorter>, List<Yw.Model.TreeSorter>>(entities);
|
return models;
|
}
|
|
//Model to Entity
|
public static Yw.Entity.TreeSorter Model2Entity(this Yw.Model.TreeSorter model)
|
{
|
if (model == null)
|
return default;
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Yw.Model.TreeSorter, Yw.Entity.TreeSorter>()
|
).CreateMapper();
|
var entities = mapper.Map<Yw.Model.TreeSorter, Yw.Entity.TreeSorter>(model);
|
return entities;
|
}
|
|
//Models to Entities
|
public static List<Yw.Entity.TreeSorter> Model2Entities(this List<Yw.Model.TreeSorter> models)
|
{
|
if (models == null || models.Count < 1)
|
return default;
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Yw.Model.TreeSorter, Yw.Entity.TreeSorter>()
|
).CreateMapper();
|
var entities = mapper.Map<List<Yw.Model.TreeSorter>, List<Yw.Entity.TreeSorter>>(models);
|
return entities;
|
}
|
|
}
|
}
|