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