public static StockRequestModel StockDTOToStockRequestModel(StockDTO stock) { return(new StockRequestModel(stock.Id, stock.ProductId, stock.Amount, stock.Date) { Product = stock.Product != null?ProductRequestChildModel.ProductDTOToProductRequestChildModel(stock.Product) : null, }); }
// system converter public static TagRequestModel TagDTOToTagRequestModel(TagDTO tag) { var tagObj = new TagRequestModel(tag.Id, tag.Name); tag.Products.ForEach(product => tagObj.Products.Add(ProductRequestChildModel.ProductDTOToProductRequestChildModel(product))); return(tagObj); }