using AutoMapper;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using IStation.Untity;
|
|
namespace IStation.Service
|
{
|
/// <summary>
|
///
|
/// </summary>
|
public partial class SoftSetting
|
{
|
|
//Entity to GetModel
|
private Model.SoftSetting Entity2Model(Entity.SoftSetting entity)
|
{
|
if (entity == null)
|
return default;
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Entity.SoftSetting, Model.SoftSetting>()
|
).CreateMapper();
|
var model = mapper.Map<Entity.SoftSetting, Model.SoftSetting>(entity);
|
return model;
|
}
|
//Entities to GetModels
|
private List<Model.SoftSetting> Entity2Models(List<Entity.SoftSetting> entities)
|
{
|
if (entities == null || entities.Count() < 1)
|
return default;
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Entity.SoftSetting, Model.SoftSetting>()
|
).CreateMapper();
|
var models = mapper.Map<List<Entity.SoftSetting>, List<Model.SoftSetting>>(entities);
|
return models;
|
}
|
|
//Model to Entity
|
private Entity.SoftSetting Model2Entity(Model.SoftSetting model)
|
{
|
if (model == null)
|
return default;
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Model.SoftSetting, Entity.SoftSetting>()
|
).CreateMapper();
|
var entity = mapper.Map<Model.SoftSetting, Entity.SoftSetting>(model);
|
return entity;
|
}
|
|
//Models to Entities
|
private List<Entity.SoftSetting> Model2Entities(List<Model.SoftSetting> models)
|
{
|
if (models == null || models.Count < 1)
|
return default;
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Model.SoftSetting, Entity.SoftSetting>()
|
).CreateMapper();
|
var entities = mapper.Map<List<Model.SoftSetting>, List<Entity.SoftSetting>>(models);
|
return entities;
|
}
|
|
//Model to Entity
|
private void Model2Entity(Model.SoftSetting model, Entity.SoftSetting entity)
|
{
|
if (model == null || entity == null)
|
return;
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Model.SoftSetting, Entity.SoftSetting>()
|
).CreateMapper();
|
mapper.Map(model, entity);
|
}
|
}
|
}
|