public void EditProduct(Order order) { OrderManager manager = OrderManagerFactory.Create(); var newProduct = SystemIO.EditGetProduct(); order.ProductType = newProduct; FindProductTypeResponse response = manager.GetProductData(newProduct); if (response.Success) //edit issue is here { order.ProductType = response.Product.ProductType; order.CostPerSquareFoot = response.Product.CostPerSquareFoot; order.LaborCostPerSquareFoot = response.Product.LaborCostPerSquareFoot; manager.SaveExistingOrder(order); SystemIO.DisplaySingleOrderDetails(order); Console.ReadKey(); Console.Clear(); } else { response.Success = false; } }
public void Execute() { OrderManager manager = OrderManagerFactory.Create(); Order order = new Order(); string dateInput = SystemIO.OrderDateRequest(); DateTime orderDate = Convert.ToDateTime(dateInput); order.Date = orderDate; string input = SystemIO.EditCustName(); order.CustomerName = input; string userInput = SystemIO.EditState(); FindStateResponse stateResponse = manager.GetStateTax(userInput); order.State = userInput; if (stateResponse.Success) { order.TaxData = stateResponse.StateTax.TaxRate; } else { stateResponse.Success = false; } string productInput = SystemIO.EditGetProduct(); OrderManager productManager = OrderManagerFactory.Create(); FindProductTypeResponse findProduct = productManager.GetProductData(productInput); order.ProductType = productInput; if (findProduct.Success) { order.ProductType = findProduct.Product.ProductType; order.CostPerSquareFoot = findProduct.Product.CostPerSquareFoot; order.LaborCostPerSquareFoot = findProduct.Product.LaborCostPerSquareFoot; } else { findProduct.Success = false; } decimal areaInput = SystemIO.EditGetArea(); order.Area = areaInput; manager.SaveNewOrder(order); SystemIO.DisplaySingleOrderDetails(order); Console.ReadKey(); }