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