Ejemplo n.º 1
0
        public Orders Calculate(Orders order)
        {
            Products selectedProduct = ProductsRepository.LoadProducts()
                                       .FirstOrDefault(p => p.ProductType == order.ProductType);

            Taxes selectedTax = TaxesRepository.LoadTaxes()
                                .FirstOrDefault(t => t.StateAbbreviation == order.State);

            if (selectedProduct == null)
            {
                throw new Exception("Product not found!");
            }
            if (selectedTax == null)
            {
                throw new Exception("State not found!");
            }

            order.CostPerSquareFoot      = selectedProduct.CostPerSquareFoot;
            order.LaborCostPerSquareFoot = selectedProduct.LaborCostPerSquareFoot;
            order.TaxRate = selectedTax.TaxRate;

            return(order);
        }
Ejemplo n.º 2
0
        public List <Taxes> GetListTaxes()
        {
            List <Taxes> taxes = TaxesRepository.LoadTaxes();

            return(taxes);
        }