/// <summary>
        /// Method to search through all <c>Customer</c> objects
        /// </summary>
        /// <returns>
        /// A list of <c>Customer</c> objects from the database. If not found, returns null
        /// </returns>
        public List <Customer> CustomerSearch()
        {
            newCustomer = new Customer();


            newCustomer.FirstName = InputPrompts.FirstNamePrompt();
            newCustomer.LastName  = InputPrompts.LastNamePrompt();

            var dbCustomerSearch = db.Customers.Where(x => x.FirstName == newCustomer.FirstName && x.LastName == newCustomer.LastName).ToList();

            return(dbCustomerSearch);
        }
        /// <summary>
        /// This method prompts for a location ID then prints the current inventory at this location
        /// </summary>
        public void PrintInventory()
        {
            var dbLocations = db.Locations.ToList();

            Console.WriteLine("List of Locations:\n");
            foreach (var obj in dbLocations)
            {
                Console.WriteLine(obj.ToString());
            }
            try
            {
                newLocation = db.Locations.FirstOrDefault(x => x.ID == InputPrompts.IDPrompt("Location"));
            }
            catch (Exception e)
            {
                Console.WriteLine($"Error retrieving Location from the database:\n{e}");
            }
            if (newLocation != null)
            {
                try
                {
                    InventoryList = db.Inventory.Include("Product").Include("Location").Where(x => x.Location.ID == newLocation.ID).ToList();
                }
                catch (Exception e)
                {
                    Console.WriteLine($"Error retrieving inventory list from database:\n{e}");
                }
                if (InventoryList.Count > 0)
                {
                    Console.WriteLine("Current Inventory Items:\n");
                    foreach (Inventory inv in InventoryList)
                    {
                        inv.PrintInfo();
                    }
                }
                else
                {
                    Console.WriteLine("Currently no items have been added to this inventory.");
                }
            }
        }
        /// <summary>
        /// The method to add product records
        /// Runs through a prompt to gather and validate product info
        /// </summary>
        /// <remarks>
        /// Checks to see if the product name already exists, and prevents addition
        /// </remarks>
        /// <returns>
        /// A <c>Product</c> object containing the new Product info
        /// </returns>
        public Product AddProduct()
        {
            string productTemp = "";

            //while true loop to handle data input
            //Regex pattern to validate input, repeat loop until correct
            try
            {
                productTemp = InputPrompts.ProductNamePrompt();
            }
            catch (Exception e)
            {
                Console.WriteLine($"Error entering product name:\n{e}");
            }
            //Query the database to check for another product with the same name
            //If it exists, re-prompt
            newProduct = db.Products.Where(x => x.ProductName == productTemp).FirstOrDefault();
            if (newProduct != null)
            {
                Console.WriteLine("Product already exists. Please enter a unique product name.");
                newProduct = AddProduct();
            }

            try
            {
                //Call a new instance of the Product class, and assign the ProductName property the newly input value
                newProduct             = new Product();
                newProduct.ProductName = productTemp;

                //Prompt for the product description

                newProduct.ProductDescription = InputPrompts.ProductDescriptionPrompt();


                //Prompt for the product price

                newProduct.Price = InputPrompts.ProductPricePrompt();
            }
            catch (Exception e)
            {
                Console.WriteLine($"Error entering product information:\n{e}");
            }
            //Print the newly input information and confirm the saving
            newProduct.PrintInfo();
            do
            {
                Console.WriteLine("Create new product with this new information?");
                Console.WriteLine("Press Y to confirm");
                Console.WriteLine("Press N to reinput information");
                Console.WriteLine("Press C to cancel");

                //Console Key used to control the navigation
                response = Console.ReadKey(false).Key;
                if (response == ConsoleKey.Y)
                {
                    //Return the new product object
                    return(newProduct);
                }
                if (response == ConsoleKey.N)
                {
                    //Recall the method if you choose to reinput the information
                    Console.WriteLine();
                    return(this.AddProduct());
                }
                if (response == ConsoleKey.C)
                {
                    //End the loop and return null to cancel the creation
                    break;
                }
            } while (response != ConsoleKey.Y && response != ConsoleKey.N && response != ConsoleKey.C);
            return(null);
        }
        /// <summary>
        /// The method to increase the inventory of an item
        /// Prompts for location and product id
        /// </summary>
        /// <remarks>
        /// If there is no inventory item present, one is created
        /// </remarks>
        /// <returns>
        /// An <c>Inventory</c> object containing the new Inventory status
        /// </returns>
        public Inventory AddToInventory()
        {
            int idTemp       = 0;
            int quantityTemp = 0;

            newInventory = new Inventory();
            var dbLocations = db.Locations.ToList();

            //Print out a list of locations to select from
            Console.WriteLine("List of Locations:\n");
            foreach (var obj in dbLocations)
            {
                Console.WriteLine(obj.ToString());
            }
            var dbLocation = new Location();

            //Loop to check if Location ID is present
            while (true)
            {
                idTemp     = InputPrompts.IDPrompt("Location");
                dbLocation = db.Locations.FirstOrDefault(x => x.ID == idTemp);
                if (dbLocation != null)
                {
                    break;
                }
                Console.WriteLine("Location ID not found. Please try again.");
            }

            //List out the products available at the location given
            var dbentry = db.Products.ToList();

            Console.WriteLine("List of products:\n");
            foreach (var obj in dbentry)
            {
                Console.WriteLine(obj.ToString());
            }
            var dbProduct = new Product();

            while (true)
            {
                idTemp = InputPrompts.IDPrompt("Product");
                //Check to see if the product exists
                dbProduct = db.Products.FirstOrDefault(x => x.ID == idTemp);
                if (dbProduct != null)
                {
                    break;
                }
                Console.WriteLine("Product ID not found. Please try again.");
            }
            try
            {
                quantityTemp = InputPrompts.QuantityPrompt();
            }
            catch (Exception e)
            {
                Console.WriteLine($"Error with quantity prompt:\n{e}");
            }
            //Check to see if Product Exists in inventory.
            //If it does not, create an object and add it.
            //If it does, add the quantity to the existing object
            var dbInventory = db.Inventory.Include("Product").Include("Location").FirstOrDefault(x => x.Product == dbProduct && x.Location == dbLocation);

            if (dbInventory != null)
            {
                dbInventory.Quantity += quantityTemp;
                newInventory          = dbInventory;
            }
            else
            {
                newInventory.Product  = dbProduct;
                newInventory.Location = dbLocation;
                newInventory.Quantity = quantityTemp;
                db.Add(newInventory);
            }
            db.SaveChanges();
            return(newInventory);
        }
        /// <summary>
        /// The method to add customer records
        /// Runs through prompt to gather and validate customer info
        /// </summary>
        /// <returns>
        /// A <c>Customer</c> object containing the new customer info
        /// </returns>
        public Customer AddCustomer()
        {
            newCustomer = new Customer();
            //While true loops used to control the data prompting - Thanks @Will Ruiz for the idea!
            //Does not break until input is validated
            //uses Regex patterns to validate the inputs
            //Pattens contained in Regex pattern class

            #region Customer Input Prompts



            try
            {
                newCustomer.FirstName    = InputPrompts.FirstNamePrompt();
                newCustomer.LastName     = InputPrompts.LastNamePrompt();
                newCustomer.AddressLine1 = InputPrompts.Address1Prompt();
                newCustomer.AddressLine2 = InputPrompts.Address2Prompt();
                newCustomer.City         = InputPrompts.CityPrompt();
                newCustomer.State        = InputPrompts.StatePrompt();
                newCustomer.ZipCode      = InputPrompts.ZipPrompt();
                newCustomer.Phone        = InputPrompts.PhonePrompt();
                newCustomer.Email        = InputPrompts.EmailPrompt();
            }
            catch (System.Exception e)
            {
                Console.WriteLine($"Error inputting customer information:\n{e}.");
            }

            #endregion
            //Print out the information that was input for confirmation
            newCustomer.PrintInfo();


            //Do loop to prompt for confirmation. If confirmed, data is stored to the database as a new customer
            do
            {
                Console.WriteLine("Create new customer with this new information?");
                Console.WriteLine("Press Y to confirm");
                Console.WriteLine("Press N to reinput information");
                Console.WriteLine("Press C to cancel");

                //Using this readkey object to manage navigation
                response = Console.ReadKey(false).Key;
                if (response == ConsoleKey.Y)
                {
                    //If confirmed, add the customer to the database
                    Console.WriteLine();
                    db.Add(newCustomer);
                    db.SaveChanges();
                    return(newCustomer);
                }
                if (response == ConsoleKey.N)
                {
                    //Recall the method to reinput the customer information
                    Console.WriteLine();
                    return(this.AddCustomer());
                }
                if (response == ConsoleKey.C)
                {
                    //break the loop to cancel the customer creation
                    break;
                }
            } while (response != ConsoleKey.Y && response != ConsoleKey.N && response != ConsoleKey.C);
            return(null);
        }