static void ManagePrice() { string productCodeInput = ""; double newPriceInput = -1; bool isDouble = false; bool isExist = false; IPriceService priceService = null; IProductService productService = null; try { priceService = new PriceService(); productService = new ProductService(); Console.Clear(); Console.WriteLine("-- Price Management --"); Console.WriteLine("=============================================="); while (isExist == false) { ProductModel selectedProduct = null; do { Console.Write("Product Code: "); productCodeInput = Console.ReadLine(); isExist = productCodeInput.ToUpper().Equals("E0"); if (isExist == false) { selectedProduct = productService.GetProductInfoByCode(productCodeInput); } }while (isExist == false && selectedProduct == null); if (isExist == false) { Console.WriteLine($"Current Price: {selectedProduct.Price}/{selectedProduct.Measure}"); do { Console.Write("New Price: "); isDouble = double.TryParse(Console.ReadLine(), out newPriceInput); }while (isDouble == false && newPriceInput < 0); priceService.AddNewPrice(selectedProduct.Id, newPriceInput); } ConsoleHelper.DrawHorizontalLine('-', 50); } ConsoleHelper.DrawHorizontalLine('=', 50); } catch (Exception ex) { throw ex; } finally { priceService = null; productService = null; } }