public SaleOff ToModel(SaleOff saleOff = null) { if (saleOff == null) { saleOff = new SaleOff(); saleOff.Id = Guid.NewGuid(); } saleOff.BeginDate = BeginDate; saleOff.EndDate = EndDate; saleOff.Quantity = Quantity; saleOff.ProductId = ProductId; return(saleOff); }
public SaleOffDto(SaleOff saleOff, params object[] args) { Id = saleOff.Id; BeginDate = saleOff.BeginDate; EndDate = saleOff.EndDate; Quantity = saleOff.Quantity; ProductId = saleOff.ProductId; foreach (var arg in args) { if (arg is Product product) { ProductDto = new ProductDto(product); } } }