public async Task <ActionResult> AddressAndPayment(IFormCollection values) { var order = new Order(); bool success = TryUpdateModelAsync <Order>(order).Result; try { if (string.Equals(values["PromoCode"], PromoCode, StringComparison.OrdinalIgnoreCase) == false) { return(View(order)); } else { order.Username = new ContextHelper().GetUsernameFromClaims(this.HttpContext); order.OrderDate = DateTime.Now; try { // get cart items var cartId = new ShoppingCartHelper(this.HttpContext).GetCartId(); var cartItems = await shoppingCartApiHelper.GetAsync <List <Cart> >("/api/ShoppingCart/CartItems?id=" + cartId); // avoid sending unuseful data on to the service cartItems.ForEach((item) => { item.Album.Genre = null; item.Album.Artist = null; }); OrderCreation creation = new OrderCreation() { OrderToCreate = order, CartItems = cartItems }; int orderId = await orderApiHelper.PostAsync <OrderCreation, int>("/api/AddressAndPayment", creation); await shoppingCartApiHelper.PostAsync <string>("/api/ShoppingCart/EmptyCart", $"'{cartId}'"); return(RedirectToAction("Complete", new { id = orderId })); } catch (Exception) { //Log return(View(order)); } } } catch (Exception) { //Invalid - redisplay with errors return(View(order)); } }
public void UnreasonableOrderTest() { // arrange OrderCreation test = new OrderCreation(); // act int unreasonable1 = 25; int unreasonable2 = 5; // assert Assert.True(test.IsUnreasonableQuantity(unreasonable1)); Assert.False(test.IsUnreasonableQuantity(unreasonable2)); }
public void ValidNumTests() { // arrange OrderCreation test = new OrderCreation(); // act string validNum1 = "Mike"; string validNum2 = "32"; // assert Assert.False(test.IsValidNum(validNum1)); Assert.True(test.IsValidNum(validNum2)); }
public void StringToIntTests() { // arrange OrderCreation test = new OrderCreation(); // act string stringToInt1 = "45"; string stringToInt2 = "word"; string stringToInt3 = "273"; // assert Assert.Equal(45, test.StringToInt(stringToInt1)); Assert.Equal(0, test.StringToInt(stringToInt2)); Assert.Equal(273, test.StringToInt(stringToInt3)); }
public void UnknownProduct() { // Setup var handler = new OrderCreation(_orderRepository, _productCatalog); var sellItemsRequest = new SellItemsRequest { Items = new List <SellItemRequest> { new SellItemRequest { ProductName = "hamburger", Quantity = 1 }, } }; // Exercise & Verify Action act = () => handler.Handle(sellItemsRequest); act.Should().ThrowExactly <UnknownProductException>(); }
public void ResetLevel() { List <ItemUpgrades> allItems = new List <ItemUpgrades>(); allItems.AddRange(customerLines); allItems.AddRange(ovens); allItems.AddRange(toppings); foreach (var item in allItems) { item.ShowItem(); } OrderCreation orderCreation = FindObjectOfType <OrderCreation>(); orderCreation.tierOneIngredients.Clear(); orderCreation.tierTwoIngredients.Clear(); orderCreation.tierThreeIngredients.Clear(); }
public static async Task <HttpResponseMessage> Run( [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)] HttpRequestMessage req, TraceWriter log) { OrderCreation creation = await req.Content.ReadAsAsync <OrderCreation>(); var storeDB = new DbContextHelper().GetContext(); var order = creation.OrderToCreate; //Save Order storeDB.Orders.Add(order); storeDB.SaveChanges(); //Process the order decimal orderTotal = 0; // Iterate over the items in the cart, adding the order details for each foreach (var item in creation.CartItems) { var orderDetail = new OrderDetail { AlbumId = item.AlbumId, OrderId = order.OrderId, UnitPrice = item.Album.Price, Quantity = item.Count }; // Set the order total of the shopping cart orderTotal += (item.Count * item.Album.Price); storeDB.OrderDetails.Add(orderDetail); } // Set the order's total to the orderTotal count order.Total = orderTotal; // Save the order storeDB.SaveChanges(); return(req.CreateResponse(HttpStatusCode.OK, order.OrderId)); }
public ActionResult <Order> PostOrder([FromBody] OrderCreation order) { try { Order orderEntity = mapper.Map <Order>(order); if (orderEntity == null) { return(BadRequest()); } var addedOrder = orderRepository.CreateOrder(orderEntity); return(Ok(addedOrder)); } catch (Exception) { return(StatusCode(StatusCodes.Status500InternalServerError, "Create error")); } }
public void SellMultipleItems() { // Setup var handler = new OrderCreation(_orderRepository, _productCatalog); var sellItemsRequest = new SellItemsRequest { Items = new List <SellItemRequest> { new SellItemRequest { ProductName = "salad", Quantity = 2 }, new SellItemRequest { ProductName = "tomato", Quantity = 3 }, } }; // Exercise handler.Handle(sellItemsRequest); // Verify var actual = _orderRepository.getLastSavedOrder(); actual.Total.Should().Be(23.20M); actual.Tax.Should().Be(2.13M); actual.Currency.Should().Be("EUR"); actual.Items.Count.Should().Be(2); actual.Items.Should().HaveCount(2); actual.Items.First().Product.Name.Should().Be("salad"); actual.Items.First().Product.Price.Should().Be(3.56M); actual.Items.First().Quantity.Should().Be(2); actual.Items.First().TaxedAmount.Should().Be(7.84M); actual.Items.First().Tax.Should().Be(0.72M); actual.Items.Last().Product.Name.Should().Be("tomato"); actual.Items.Last().Product.Price.Should().Be(4.65M); actual.Items.Last().Quantity.Should().Be(3); actual.Items.Last().TaxedAmount.Should().Be(15.36M); actual.Items.Last().Tax.Should().Be(1.41M); }
public ActionResult <int> AddressAndPayment(OrderCreation creation) { var order = creation.OrderToCreate; //Save Order storeDB.Orders.Add(order); storeDB.SaveChanges(); //Process the order //shoppingCart.CreateOrder(order); decimal orderTotal = 0; // Iterate over the items in the cart, adding the order details for each foreach (var item in creation.CartItems) { var orderDetail = new OrderDetail { AlbumId = item.AlbumId, OrderId = order.OrderId, UnitPrice = item.Album.Price, Quantity = item.Count }; // Set the order total of the shopping cart orderTotal += (item.Count * item.Album.Price); storeDB.OrderDetails.Add(orderDetail); } // Set the order's total to the orderTotal count order.Total = orderTotal; // Save the order storeDB.SaveChanges(); return(order.OrderId); }
void Start() { gameManager = GetComponent <GameManager>(); orderCreation = GetComponent <OrderCreation>(); }
/// <summary> /// input/output for the process of displaying an customer's history with all /// the validation taking place along the way and finally displaying /// the history of the customer meeting the input parameters. /// </summary> public void DisplayCustomerHistory() { CustomerQueries checkCustomer = new CustomerQueries(); OrderCreation checkNum = new OrderCreation(); // get and display all the customer info to pick from var customers = checkCustomer.GetCustomers(); Console.WriteLine("ID\tFirst Name\tLast Name\tUsername"); foreach (var c in customers) { Console.WriteLine($"{c.CustomerID}\t{c.FirstName}" + $"\t\t{c.LastName}\t\t{c.UserName}"); } Console.WriteLine("Please enter an ID from above for the customer you would like to see."); int customerID; do { string input = Console.ReadLine(); if (input == "cancel") { return; } // check if input is an int while (!checkNum.IsValidNum(input)) { Console.WriteLine("Invalid ID number, please enter another."); input = Console.ReadLine(); if (input == "cancel") { return; } } int id = checkNum.StringToInt(input); // check to see if there is a customer with the given ID if (checkCustomer.IsValidCustomerID(id)) { customerID = id; } else { Console.WriteLine("There is no customer with this ID, please enter another."); customerID = 0; } } while (customerID == 0); // repeat if no customer with that ID var customerHistory = checkCustomer.GetCustomerHistory(customerID); var customer = checkCustomer.GetCustomer(customerID); // get and display the order history of that customer if they have one if (customerHistory.Count() == 0) { Console.WriteLine($"As of now, {customer.FirstName} {customer.LastName} has placed no orders."); } else { Console.WriteLine($"Order history for {customer.FirstName} {customer.LastName}"); Console.WriteLine("Location\tOrder ID\tProduct\t\tQuantity\tTotal\t\tTimestamp"); foreach (var o in customerHistory) { double price = o.Product.Price * o.Quantity; Console.WriteLine($"{o.Product.Store.Location}\t{o.OrderID}\t\t" + $"{o.Product.ProductName}\t" + $"{o.Quantity}\t\t${price}\t\t{o.Timestamp}"); } } Console.WriteLine("Press enter to return to the menu"); Console.ReadLine(); }
/// <summary> /// input/output for the process of displaying an store's history with all /// the validation taking place along the way and finally displaying /// the history of the store meeting the input parameters. /// </summary> public void DisplayStoreHistory() { StoreQueries checkStore = new StoreQueries(); OrderCreation checkNum = new OrderCreation(); // get and display stores to pick from var stores = checkStore.GetStores(); Console.WriteLine("ID\tLocation"); foreach (var s in stores) { Console.WriteLine($"{s.StoreID}\t{s.Location}"); } Console.WriteLine("Please enter an ID from above for the store location you would like to see."); int storeID; do { string input = Console.ReadLine(); if (input == "cancel") { return; } // check if input is an int while (!checkNum.IsValidNum(input)) { Console.WriteLine("Invalid ID number, please enter another."); input = Console.ReadLine(); if (input == "cancel") { return; } } int id = checkNum.StringToInt(input); // check if there is a store with the given ID if (checkStore.IsValidStoreID(id)) { storeID = id; } else { Console.WriteLine("There is no store with this ID, please enter another."); storeID = 0; } } while (storeID == 0); // repeat if no store with that ID var storeHistory = checkStore.GetStoreHistory(storeID); var storeLocation = checkStore.GetStoreLocation(storeID); // get and display all the order history for that location if (storeHistory.Count() == 0) { Console.WriteLine($"As of now, no orders have been made from {storeLocation}"); } else { Console.WriteLine($"Order history for {storeLocation}"); Console.WriteLine("Customer\tProduct\t\tQuantity\tTotal\t\tTimestamp"); foreach (var o in storeHistory) { double price = o.Product.Price * o.Quantity; Console.WriteLine($"{o.Customer.FirstName} {o.Customer.LastName}\t" + $"{o.Product.ProductName}\t{o.Quantity}" + $"\t\t${price}\t\t{o.Timestamp}"); } } Console.WriteLine("Press enter to return to the menu"); Console.ReadLine(); }
/// <summary> /// input/output for the process of displaying an order's details with all /// the validation taking place along the way and finally displaying /// the details of the order meeting the input parameters. /// </summary> public void DisplayOrderDetails() { OrderCreation createOrder = new OrderCreation(); // for Validation method OrderQueries checkOrder = new OrderQueries(); int orderID; // get and display orders to pick from var orders = checkOrder.GetOrders(); Console.WriteLine("ID\tTimestamp"); foreach (var o in orders) { Console.WriteLine($"{o.OrderID}\t{o.Timestamp}"); } Console.WriteLine("Please enter the ID of the order you would like to see"); do { string input = Console.ReadLine(); if (input == "cancel") { return; } // check if input is an int while (!createOrder.IsValidNum(input)) { Console.WriteLine("Invalid order ID number, please enter another."); input = Console.ReadLine(); if (input == "cancel") { return; } } int id = createOrder.StringToInt(input); // check if there is an order with the given ID if (checkOrder.IsValidOrderID(id)) { orderID = id; } else { Console.WriteLine("There is no order with this ID, please enter another."); orderID = 0; } } while (orderID == 0); var orderDetails = checkOrder.GetOrderDetails(orderID); // get all the order details and display them to console Console.WriteLine("Customer\tStore Location\t\tProduct\t\tQuantity\tTotal\tTimestamp"); foreach (var o in orderDetails) { double price = o.Product.Price * o.Quantity; Console.WriteLine($"{o.Customer.FirstName} {o.Customer.LastName}\t" + $"{o.Product.Store.Location}\t\t{o.Product.ProductName}\t{o.Quantity}" + $"\t\t${price}\t{o.Timestamp}"); } Console.WriteLine("Press enter to return to the menu"); Console.ReadLine(); }
/// <summary> /// input/output for the process of adding a new order with all /// the validation taking place along the way and finally adding /// a new order with the given information. /// </summary> public void AddNewOrder() { // declare new instance(s) using (StoreApp_DbContext db = new StoreApp_DbContext()) { OrderCreation createOrder = new OrderCreation(); CustomerQueries checkCustomer = new CustomerQueries(); Order newOrder = new Order(); Console.WriteLine("Please enter the customerID of your Customer placing an order."); do { string input = Console.ReadLine(); if (input == "cancel") { return; } // check if input is an int while (!createOrder.IsValidNum(input)) { Console.WriteLine("Invalid customerID number, please enter another."); input = Console.ReadLine(); if (input == "cancel") { return; } } // check if there is a customer with the inputted ID int id = createOrder.StringToInt(input); if (checkCustomer.IsValidCustomerID(id)) { newOrder.CustomerID = id; } else { Console.WriteLine("There is no Customer with this ID, please enter another."); newOrder.CustomerID = 0; } } while (newOrder.CustomerID == 0); // repeat if there is no customer with the ID // display all the available products ProductQueries checkProducts = new ProductQueries(); var products = checkProducts.GetProducts(); Console.WriteLine("Here are all the available products:"); Console.WriteLine("ID\tStore\t\tName\t\tInventory\tPrice"); foreach (var p in products) { Console.WriteLine($"{p.ProductID}\t{p.Store.Location}\t{p.ProductName}" + $"\t{p.Inventory}\t\t{p.Price}"); } bool multipleProducts; int productCount = 0; do { Console.WriteLine("Please enter the ID of the product being ordered"); do { string input = Console.ReadLine(); if (input == "cancel") { return; } // check if input is an int while (!createOrder.IsValidNum(input)) { Console.WriteLine("Invalid product ID number, please enter another."); input = Console.ReadLine(); if (input == "cancel") { return; } } int id = createOrder.StringToInt(input); // check if there is a product with the inputted ID if (checkProducts.IsValidProductID(id)) { newOrder.ProductID = id; } else { Console.WriteLine("There is no product with this ID or there is none left, please enter another."); newOrder.ProductID = 0; } } while (newOrder.ProductID == 0); // repeat if no product with that ID var product = checkProducts.GetProductName(newOrder.ProductID); Console.WriteLine($"For buying, specify the number of {product.ProductName}"); do { string input = Console.ReadLine(); if (input == "cancel") { return; } // check if input is an int while (!createOrder.IsValidNum(input)) { Console.WriteLine("Invalid amount, please enter another."); input = Console.ReadLine(); if (input == "cancel") { return; } } int amount = createOrder.StringToInt(input); // check if the inventory is high enough for given amount if (amount == 0) { Console.WriteLine("Please specify an amount"); } else if (createOrder.IsUnreasonableQuantity(amount)) { // if the amount requested is unreasonable (>=10) Console.WriteLine($"{amount} is an unreasonable amount of {product.ProductName}"); newOrder.Quantity = 0; } else if (checkProducts.IsValidProductQuantity(amount, newOrder.ProductID)) { // if there is enough product and it is reasonable newOrder.Quantity = amount; } else { Console.WriteLine($"There is not {amount} available at this store, please enter another amount."); newOrder.Quantity = 0; } } while (newOrder.Quantity == 0); // repeat if not enough product or unreasonable Console.WriteLine("Would you like to include another product in this order (yes or no)?"); string addProduct = Console.ReadLine(); if (addProduct == "cancel") { return; } // check if they are saying yes or no to extra product while (addProduct != "yes" && addProduct != "no") { Console.WriteLine("Please pick put in one of the two"); addProduct = Console.ReadLine(); if (addProduct == "cancel") { return; } } if (addProduct == "yes") { multipleProducts = true; } else { multipleProducts = false; } productCount++; if (productCount == 1) { // keep same timestamp for multiple product order newOrder.Timestamp = createOrder.GetTimeStamp(); } db.Add <Order>(newOrder); db.SaveChanges(); StoreQueries updateStore = new StoreQueries(); updateStore.UpdateInventory(newOrder); newOrder.OrderID++; } while (multipleProducts); // go back if they wanted another product Console.WriteLine("Order successfully placed! Hit enter to go back to menu."); Console.ReadLine(); } }
public void Execute() { OrderManager manager = OrderManagerFactory.Create(); TaxStateManager stateManager = TaxStateManagerFactory.Create(); ProductManager productManager = ProductManagerFactory.Create(); InputRules inputManager = new InputRules(); Order order = new Order(); DateTime orderDate = DateTime.MinValue; Console.Clear(); Console.WriteLine("Add an Order"); Console.WriteLine("--------------------"); //GET ORDER DATE OrderLookupResponse response = new OrderLookupResponse(); DateCheckResponse dateResponse = new DateCheckResponse(); dateResponse.Success = false; int orderNumber = 1; while (!dateResponse.Success) { Console.WriteLine("Please enter the Order Date you would like to add:"); while (!DateTime.TryParse(Console.ReadLine(), out orderDate)) { Console.WriteLine("That is not a valid format, please try again"); } dateResponse = inputManager.DateCheck(orderDate); Console.WriteLine(dateResponse.Message); } response = manager.AllOrderLookup(orderDate); if (response.Success) { foreach (Order entry in response.Orders) { ConsoleIO.DisplayOrder(entry); } Console.WriteLine(); Console.WriteLine("Here is the current status of this Order Date"); if (response.Orders != null) { orderNumber = response.Orders.LastOrDefault().OrderNumber + 1; } } //GET CUSTOMER NAME string nameInput = null; NameCheckResponse nameResponse = new NameCheckResponse(); nameResponse.Success = false; while (!nameResponse.Success) { Console.Write("Enter the Customer's Name: "); nameInput = Console.ReadLine().Replace(',', '|').Trim(); nameResponse = inputManager.NameCheck(nameInput); Console.WriteLine(nameResponse.Message); } Console.Clear(); //GET STATE string stateInput = null; Console.WriteLine("These are the states in our system, please enter which state."); foreach (TaxState state in stateManager.GetTaxStates()) { Console.WriteLine(state.StateName + ", " + state.StateCode); } TaxStateLookupResponse stateResponse = new TaxStateLookupResponse(); StateInputCheckResponse stateInputResponse = new StateInputCheckResponse(); stateResponse.Success = false; stateInputResponse.Success = false; while (!stateResponse.Success) { while (!stateInputResponse.Success) { Console.Write("Enter the State: "); stateInput = Console.ReadLine(); stateInputResponse = inputManager.StateCheck(stateInput); Console.WriteLine(stateInputResponse.Message); } stateResponse = stateManager.FindTaxState(stateInput); if (!stateResponse.Success) { Console.WriteLine(stateResponse.Message); Console.Write("Enter the State: "); stateInput = Console.ReadLine(); } } Console.Clear(); //GET PRODUCT MATERIAL string productInput = null; Console.WriteLine("These are the materials availbale to choose from:"); foreach (Product product in productManager.GetProducts()) { Console.WriteLine(string.Format("{0}, Labor Cost: {1}, Material Cost: {2}", product.ProductType, product.LaborCostPerSquareFoot, product.CostPerSquareFoot)); } ProductLookupResposnse productResponse = new ProductLookupResposnse(); ProductInputCheckResponse productInputResponse = new ProductInputCheckResponse(); productResponse.Success = false; productInputResponse.Success = false; while (!productResponse.Success) { while (!productInputResponse.Success) { Console.Write("Enter the Type of materials: "); productInput = Console.ReadLine(); productInputResponse = inputManager.ProductCheck(productInput); Console.WriteLine(productInputResponse.Message); } productResponse = productManager.FindProduct(productInput); if (!productResponse.Success) { Console.WriteLine(productResponse.Message); Console.Write("Enter the Type of materials: "); productInput = Console.ReadLine(); } } Console.Clear(); //GET AREA decimal areaInput = 0; AreaCheckResponse areaResponse = new AreaCheckResponse(); areaResponse.Success = false; while (!areaResponse.Success) { Console.Write("Enter the square footage of the Area: "); while (!decimal.TryParse(Console.ReadLine(), out areaInput)) { Console.WriteLine("That is not a valid input."); } areaResponse = inputManager.AreaCheck(areaInput); Console.WriteLine(areaResponse.Message); } Console.WriteLine("Press any key to continue..."); Console.ReadKey(); order = OrderCreation.CreateOrder(orderDate, orderNumber, nameInput, stateInput, productInput, areaInput); Console.Clear(); ConsoleIO.DisplayOrder(order); Console.WriteLine(); string answer = null; while (answer == null) { Console.WriteLine("Do you want to save this order? (Y/N)"); answer = Console.ReadLine().ToUpper(); switch (answer) { case "Y": manager.CreateOrder(order); Console.WriteLine("Order Saved"); break; case "N": Console.WriteLine("Order Not Saved"); break; default: Console.WriteLine("That is not a valid input, try again"); answer = null; break; } } Console.WriteLine("Press any key to continue..."); Console.ReadKey(); return; }
public void Execute() { InputRules inputManager = new InputRules(); OrderManager manager = OrderManagerFactory.Create(); TaxStateManager stateManager = TaxStateManagerFactory.Create(); ProductManager productManager = ProductManagerFactory.Create(); Order order = new Order(); DateTime orderDate; string stateInput, productInput, tempAreaInput; Console.Clear(); Console.WriteLine("Edit an Order"); Console.WriteLine("--------------------"); //Get order date file Console.WriteLine("Please enter the Order Date you would like to edit"); while (!DateTime.TryParse(Console.ReadLine(), out orderDate)) { Console.WriteLine("That is not a valid format, please try again"); } //display all orders OrderLookupResponse fileResponse = manager.AllOrderLookup(orderDate); if (fileResponse.Success) { foreach (Order entry in fileResponse.Orders) { ConsoleIO.DisplayOrder(entry); } } Console.WriteLine(); //get order number and make edits int orderNumberInput; Console.WriteLine("Enter the Order Number you'd like to edit:"); while (!int.TryParse(Console.ReadLine(), out orderNumberInput)) { Console.WriteLine("That is not a valid input. Try again"); } OrderLookupResponse response = manager.OrderLookup(orderDate, orderNumberInput); if (response.Success) { ConsoleIO.DisplayOrder(response.Order); order = response.Order; Console.WriteLine(); Console.WriteLine("Please enter new values, entering nothing will keep current value."); //Edit Name NameCheckResponse nameResponse = new NameCheckResponse(); Console.Write("Enter the Customer's Name: "); string nameInput = Console.ReadLine().Replace(',', '|').Trim(); nameResponse = inputManager.NameCheck(nameInput); if (nameInput != "") { while (!nameResponse.Success) { nameResponse = inputManager.NameCheck(nameInput); if (!nameResponse.Success) { Console.WriteLine(nameResponse.Message); Console.Write("Name: "); nameInput = Console.ReadLine(); } } order.CustomerName = nameInput; } Console.Clear(); //Display States Console.WriteLine("These are the states in our system, please enter which state."); foreach (TaxState entry in stateManager.GetTaxStates()) { Console.WriteLine(entry.StateName); } //Edit State TaxStateLookupResponse stateResponse = new TaxStateLookupResponse(); StateInputCheckResponse stateInputResponse = new StateInputCheckResponse(); Console.WriteLine("Please enter new values, entering nothing will keep current value."); Console.Write("State: "); stateInput = Console.ReadLine(); stateInputResponse = inputManager.StateCheck(stateInput); if (stateInputResponse.Success) { stateResponse.Success = false; while (!stateResponse.Success) { stateResponse = stateManager.FindTaxState(stateInput); if (!stateResponse.Success) { Console.WriteLine(stateResponse.Message); Console.Write("State: "); stateInput = Console.ReadLine(); } } order.State = stateInput; } Console.Clear(); //Display Products Console.WriteLine("These are the materials availbale to choose from:"); foreach (Product entry in productManager.GetProducts()) { Console.WriteLine(string.Format("{0}, Labor Cost: {1}, Material Cost: {2}", entry.ProductType, entry.LaborCostPerSquareFoot, entry.CostPerSquareFoot)); } //Edit Product ProductLookupResposnse productResponse = new ProductLookupResposnse(); ProductInputCheckResponse productInputResponse = new ProductInputCheckResponse(); Console.WriteLine("Please enter new values, entering nothing will keep current value."); Console.Write("Product Type: "); productInput = Console.ReadLine(); productInputResponse = inputManager.ProductCheck(productInput); if (productInputResponse.Success) { productResponse.Success = false; while (!productResponse.Success) { productResponse = productManager.FindProduct(productInput); if (!productResponse.Success) { Console.WriteLine(productResponse.Message); Console.Write("Product Type: "); productInput = Console.ReadLine(); } } order.ProductType = productInput; } Console.Clear(); //Edit Area AreaCheckResponse areaResponse = new AreaCheckResponse(); Console.Write("Area: "); decimal areaInput; tempAreaInput = Console.ReadLine(); if (tempAreaInput != "") { areaResponse.Success = false; while (!decimal.TryParse(tempAreaInput, out areaInput)) { Console.WriteLine("That is not a valid input."); Console.Write("Area: "); tempAreaInput = Console.ReadLine(); } while (!areaResponse.Success) { areaResponse = inputManager.AreaCheck(areaInput); Console.WriteLine(areaResponse.Message); } order.Area = areaInput; } Console.Clear(); if (stateInput == "" && productInput == "" && tempAreaInput == "") { order = OrderCreation.EditedOrder(order.OrderDate, order.OrderNumber, order.CustomerName, order.State, order.StateAbv, order.TaxRate, order.ProductType, order.Area, order.CostPerSqaureFoot, order.LaborCostPerSquareFoot, order.MaterialCost, order.LaborCost, order.Tax, order.Total); } else { order = OrderCreation.CreateOrder(order.OrderDate, order.OrderNumber, order.CustomerName, order.State, order.ProductType, order.Area); } ConsoleIO.DisplayOrder(order); Console.WriteLine(); string answer = null; while (answer == null) { Console.WriteLine("Do you want to save this order? (Y/N)"); answer = Console.ReadLine().ToUpper(); switch (answer) { case "Y": manager.UpdateOrder(order); Console.WriteLine("Order Saved"); break; case "N": Console.WriteLine("Order Not Saved"); break; default: Console.WriteLine("That is not a valid input, try again"); answer = null; break; } } Console.WriteLine("Press any key to continue..."); Console.ReadKey(); return; } else { Console.WriteLine("That Order does not currently exist in our system"); Console.WriteLine("Press any key to continue..."); Console.ReadKey(); return; } }