Пример #1
0
 // system converter
 public static ProductDTO ProductRequestModelToProductDTO(ProductRequestModel productRequestModel)
 {
     return(new ProductDTO()
     {
         Id = productRequestModel.Id,
         Name = productRequestModel.Name,
         Price = productRequestModel.Price,
         Sku = productRequestModel.Sku
     });
 }
Пример #2
0
        // system converter
        public static ProductRequestModel ProductDTOToProductRequestModel(ProductDTO productDTO)
        {
            var productRequestModel = new ProductRequestModel(productDTO.Id, productDTO.Name, productDTO.Price, productDTO.Sku);

            productDTO.Stocks.ForEach(stock => productRequestModel.Stocks.Add(StockRequestChildModel.StockDTOToStockRequestChildModel(stock)));

            productDTO.Tags.ForEach(tag => productRequestModel.Tags.Add(TagRequestChildModel.TagDTOToTagRequestChildModel(tag)));

            return(productRequestModel);
        }