public Product GetById(int id) { ProductLegacy legacyProduct = GetLegacyProduct(id); Product product = MapLegacyProduct(legacyProduct); return(product); }
private Product MapLegacyProduct(ProductLegacy legacyProduct) { if (legacyProduct.WT == null && legacyProduct.WT_KG == null) { throw new Exception("Invalid weight in product: " + legacyProduct.NMB_CM); } double weightInPounds = legacyProduct.WT ?? legacyProduct.WT_KG.Value * PoundsInKilogram; return(null); // new Product(legacyProduct.NMB_CM, weightInPounds); }