Пример #1
0
 // copy all rows from a List of SOAP Contracts to a List of serialized data objects
 // links:
 //  docLink: http://sql2x.org/documentationLink/1c6c6b9c-e201-4590-8c69-d38a0ad2a9f7
 public static void ContractListToDataList(List <CrudeProductContract> contractList, List <CrudeProductData> dataList)
 {
     foreach (CrudeProductContract contract in contractList)
     {
         var data = new CrudeProductData();
         CrudeProductService.ContractToData(contract, data);
         dataList.Add(data);
     }
 }
Пример #2
0
        /// <summary>
        /// save product and all entities
        /// </summary>
        /// <param name="contract"></param>
        /// <param name="userId"></param>
        /// <returns>new product id</returns>
        public Guid ProductSaveCompleteById(
            ProductContract contract,
            Guid userId
            )
        {
            // check checksum ( object has hash code )

            // move from contract to data
            var data = new Product();

            CrudeProductService.ContractToData(contract.Product, data.product);
            CrudeProductAttributeService.ContractListToDataList(contract.ProductAttribute, data.ProductAttribute);
            CrudeProductIdentifierService.ContractListToDataList(contract.ProductIdentifier, data.ProductIdentifier);
            CrudeProductInfoService.ContractListToDataList(contract.ProductInfo, data.ProductInfo);
            CrudeProductImageService.ContractListToDataList(contract.ProductImage, data.ProductImage);
            CrudeProductDocumentationService.ContractListToDataList(contract.ProductDocumentation, data.ProductDocumentation);

            // save product
            data.Save(userId);

            return(data.product.ProductId);
        }