| | |
| | | namespace HStation.Service |
| | | { |
| | | public partial class LoginUserMain |
| | | public partial class UserLoginAccount |
| | | { |
| | | //Entity to GetModel |
| | | internal static Model.LoginUserMain Entity2Model(Entity.LoginUserMain entity) |
| | | internal static Model.UserLoginAccount Entity2Model(Entity.UserLoginAccount entity) |
| | | { |
| | | if (entity == null) |
| | | return default; |
| | | var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Entity.LoginUserMain, Model.LoginUserMain>() |
| | | var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Entity.UserLoginAccount, Model.UserLoginAccount>() |
| | | ).CreateMapper(); |
| | | var model = mapper.Map<Entity.LoginUserMain, Model.LoginUserMain>(entity); |
| | | var model = mapper.Map<Entity.UserLoginAccount, Model.UserLoginAccount>(entity); |
| | | return model; |
| | | } |
| | | |
| | | //Entities to GetModels |
| | | internal static List<Model.LoginUserMain> Entity2Models(List<Entity.LoginUserMain> entities) |
| | | internal static List<Model.UserLoginAccount> Entity2Models(List<Entity.UserLoginAccount> entities) |
| | | { |
| | | if (entities == null || entities.Count < 1) |
| | | return default; |
| | | var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Entity.LoginUserMain, Model.LoginUserMain>() |
| | | var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Entity.UserLoginAccount, Model.UserLoginAccount>() |
| | | ).CreateMapper(); |
| | | var models = mapper.Map<List<Entity.LoginUserMain>, List<Model.LoginUserMain>>(entities); |
| | | var models = mapper.Map<List<Entity.UserLoginAccount>, List<Model.UserLoginAccount>>(entities); |
| | | return models; |
| | | } |
| | | |
| | | //Model to Entity |
| | | internal static Entity.LoginUserMain Model2Entity(Model.LoginUserMain model) |
| | | internal static Entity.UserLoginAccount Model2Entity(Model.UserLoginAccount model) |
| | | { |
| | | if (model == null) |
| | | return default; |
| | | var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Model.LoginUserMain, Entity.LoginUserMain>() |
| | | var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Model.UserLoginAccount, Entity.UserLoginAccount>() |
| | | ).CreateMapper(); |
| | | var entity = mapper.Map<Model.LoginUserMain, Entity.LoginUserMain>(model); |
| | | var entity = mapper.Map<Model.UserLoginAccount, Entity.UserLoginAccount>(model); |
| | | return entity; |
| | | } |
| | | |
| | | //Models to Entities |
| | | internal static List<Entity.LoginUserMain> Model2Entities(List<Model.LoginUserMain> models) |
| | | internal static List<Entity.UserLoginAccount> Model2Entities(List<Model.UserLoginAccount> models) |
| | | { |
| | | if (models == null || models.Count < 1) |
| | | return default; |
| | | var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Model.LoginUserMain, Entity.LoginUserMain>() |
| | | var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Model.UserLoginAccount, Entity.UserLoginAccount>() |
| | | ).CreateMapper(); |
| | | var entities = mapper.Map<List<Model.LoginUserMain>, List<Entity.LoginUserMain>>(models); |
| | | var entities = mapper.Map<List<Model.UserLoginAccount>, List<Entity.UserLoginAccount>>(models); |
| | | return entities; |
| | | } |
| | | |
| | | //Model to Entity |
| | | internal static void Model2Entity(Model.LoginUserMain model, Entity.LoginUserMain entity) |
| | | internal static void Model2Entity(Model.UserLoginAccount model, Entity.UserLoginAccount entity) |
| | | { |
| | | if (model == null || entity == null) |
| | | return; |
| | | var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Model.LoginUserMain, Entity.LoginUserMain>() |
| | | var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Model.UserLoginAccount, Entity.UserLoginAccount>() |
| | | ).CreateMapper(); |
| | | mapper.Map(model, entity); |
| | | } |