public VipBaoYangPackageDbModel(VipBaoYangPackageViewModel package) { if (package != null) { this.Brands = package.Brands != null?JsonConvert.SerializeObject(package.Brands) : string.Empty; this.PKID = package.PKID; this.PID = package.PID; this.PackageName = package.PackageName; this.CreateUser = package.CreateUser; this.Price = package.Price; this.SettlementMethod = package.SettlementMethod; this.VipUserId = package.VipUserId; this.Volume = package.Volume; } }
public VipBaoYangPackageDbModel(VipBaoYangPackageViewModel package) : this() { if (package != null) { this.PKID = package.PKID; this.PID = package.PID; this.PackageName = package.PackageName; this.CreateUser = package.CreateUser; this.Price = package.Price; this.SettlementMethod = package.SettlementMethod; this.VipUserId = package.VipUserId; this.Volume = package.Volume; this.OilConfigs = package.OilConfigs?.Select((config, index) => new VipBaoYangPackageOilConfig { Brand = config.Brand, Grade = config.Grade ?? string.Empty, Series = config.Series ?? string.Empty, PackageId = this.PKID, }).ToList() ?? new List <VipBaoYangPackageOilConfig>(); } }