public ProductEntity(Product Product, params object[] args) : base(Product) { foreach (object arg in args) { if (arg is Category Category) { CategoryEntity = new CategoryEntity(Category); } if (arg is Manufacturer Manufacturer) { ManufacturerEntity = new ManufacturerEntity(Manufacturer); } if (arg is ICollection <Discount> Discounts) { DiscountEntities = Discounts.Select(model => new DiscountEntity(model)).ToList(); } if (arg is ICollection <Inventory> Inventories) { InventoryEntities = Inventories.Select(model => new InventoryEntity(model, model.WareHouse)).ToList(); } if (arg is ICollection <IssueNoteLine> IssueNoteLines) { IssueNoteLineEntities = IssueNoteLines.Select(model => new IssueNoteLineEntity(model, model.IssueNote)).ToList(); } if (arg is ICollection <Pack> Packs) { PackEntities = Packs.Select(model => new PackEntity(model)).ToList(); } if (arg is ICollection <ProductPicture> ProductPictures) { ProductPictureEntities = ProductPictures.Select(model => new ProductPictureEntity(model)).ToList(); } if (arg is ICollection <ProductValue> ProductValues) { ProductValueEntities = ProductValues.Select(model => new ProductValueEntity(model, model.Attribute, model.Language)).ToList(); } if (arg is ICollection <ReceiptNoteLine> ReceiptNoteLines) { ReceiptNoteLineEntities = ReceiptNoteLines.Select(model => new ReceiptNoteLineEntity(model, model.ReceiptNote)).ToList(); } } }
public IssueNoteEntity(IssueNote IssueNote, params object[] args) : base(IssueNote) { foreach (object arg in args) { if (arg is Customer Customer) { CustomerEntity = new CustomerEntity(Customer); } if (arg is Invoice Invoice) { InvoiceEntity = new InvoiceEntity(Invoice); } if (arg is WareHouse WareHouse) { WareHouseEntity = new WareHouseEntity(WareHouse); } if (arg is ICollection <IssueNoteLine> IssueNoteLines) { IssueNoteLineEntities = IssueNoteLines.Select(model => new IssueNoteLineEntity(model, model.Product)).ToList(); } } }