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