public ProductGroupMaintainProductListVM ConvertProductGroupEntityToProductGroupMaintainProductListVM(ProductGroup data) { var vm = new ProductGroupMaintainProductListVM { ProductGroupProductVMList = new List <ProductGroupProductVM>() }; data.ProductList.ForEach(productInfo => { var product = new ProductGroupProductVM { ProductSysNo = productInfo.SysNo, ProductID = productInfo.ProductID, ProductTitle = productInfo.ProductBasicInfo.ProductTitle.Content, ProductModel = productInfo.ProductBasicInfo.ProductModel.Content, ProductBrand = new BrandVM { SysNo = productInfo.ProductBasicInfo.ProductBrandInfo.SysNo, BrandNameLocal = productInfo.ProductBasicInfo.ProductBrandInfo.BrandNameLocal.Content }, ProductCategory = new CategoryVM { SysNo = productInfo.ProductBasicInfo.ProductCategoryInfo.SysNo, CategoryName = productInfo.ProductBasicInfo.ProductCategoryInfo.CategoryName.Content }, ProductStatus = productInfo.ProductStatus, ProductCurrentPrice = productInfo.ProductPriceInfo.CurrentPrice.Round(2) }; vm.ProductGroupProductVMList.Add(product); }); return(vm); }
public ProductGroupProductVM ConvertProductInfoEntityToProductGroupProductVM(ProductInfo data) { var product = new ProductGroupProductVM { ProductSysNo = data.SysNo, ProductID = data.ProductID, ProductTitle = data.ProductBasicInfo.ProductTitle.Content, ProductModel = data.ProductBasicInfo.ProductModel.Content, ProductBrand = new BrandVM { SysNo = data.ProductBasicInfo.ProductBrandInfo.SysNo, BrandNameLocal = data.ProductBasicInfo.ProductBrandInfo.BrandNameLocal.Content }, ProductCategory = new CategoryVM { SysNo = data.ProductBasicInfo.ProductCategoryInfo.SysNo, CategoryName = data.ProductBasicInfo.ProductCategoryInfo.CategoryName.Content }, ProductStatus = data.ProductStatus, ProductCurrentPrice = data.ProductPriceInfo.CurrentPrice.Round(2) }; return(product); }