private ConsolidatedProductDTO Map(tblProduct tbl)
 {
     var dto = new ConsolidatedProductDTO
     {
         MasterId = tbl.id,
         DateCreated = tbl.IM_DateCreated,
         DateLastUpdated = tbl.IM_DateLastUpdated,
         StatusId = tbl.IM_Status,
         Description = tbl.Description,
         ProductBrandMasterId = tbl.BrandId ?? Guid.Empty,
         ProductPackagingMasterId = tbl.PackagingId ?? Guid.Empty,
         ProductPackagingTypeMasterId = tbl.PackagingTypeId ?? Guid.Empty,
         ProductCode = tbl.ProductCode,
         ReturnableTypeMasterId = tbl.ReturnableType,
         VatClassMasterId = tbl.VatClassId,
         ExFactoryPrice = tbl.ExFactoryPrice,
         ProductDetails = new List<ConsolidatedProductProductDetailDTO>()
     };
     return dto;
 }
예제 #2
0
 public ConsolidatedProduct Map(ConsolidatedProductDTO dto)
 {
     if (dto == null) return null;
     var consolidatedProduct = Mapper.Map<ConsolidatedProductDTO, ConsolidatedProduct>(dto);
     //consolidatedProduct.ProductType = _productTypeRepository.GetById(dto.ProductType);
     consolidatedProduct.Brand = _productBrandRepository.GetById(dto.ProductBrandMasterId);
     consolidatedProduct.PackagingType = _productPackagingTypeRepository.GetById(dto.ProductPackagingTypeMasterId);
     
     if (dto.VatClassMasterId != null)
         consolidatedProduct.VATClass = _vatClassRepository.GetById(dto.VatClassMasterId.Value);
     consolidatedProduct.Packaging = _productPackagingRepository.GetById(dto.ProductPackagingMasterId);
     return consolidatedProduct;
 }