public List <Cust> findUser()
        {
            DbStoreContext db       = new DbStoreContext();// set up dbcontext
            Cust           findUser = new Cust();

            while (true)
            {
                //prompts user to enter first name
                Console.WriteLine("Enter your first name");
                test = Console.ReadLine();
                //checks to make sure input is valid
                if (Regex.IsMatch(test, regNameTest))
                {
                    break;
                }
                Console.WriteLine("Invalid input. Please use letters only for this field.");
            }
            //adds first name to user
            findUser.Fname = test;
            while (true)
            {
                //prompts user to enter last name
                Console.WriteLine($"Hi, {newUser.Fname}! Please enter your last name");
                test = Console.ReadLine();
                //checks input
                if (Regex.IsMatch(test, regNameTest))
                {
                    break;
                }
                Console.WriteLine("Invalid input. Please use letters only for this field.");
            }
            //adds Last name
            findUser.Lname = test;
            var searchResults = db.Cust.Where(cust => cust.Fname == findUser.Fname && cust.Lname == findUser.Lname).ToList();

            return(searchResults);
        }
        public List <Order> findUserOrderHistory()
        {
            DbStoreContext db   = new DbStoreContext();// set up dbcontext
            Cust           find = new Cust();

            while (true)
            {
                //prompts user to enter id
                Console.WriteLine("Enter User ID");
                test = Console.ReadLine();
                //checks to make sure input is valid
                if (Regex.IsMatch(test, idTest))
                {
                    break;
                }
                Console.WriteLine("Invalid input. Please use numbers only for this field.");
            }
            //adds id to user
            find.CustId = int.Parse(test);
            //get query results
            var searchResults = db.Order.Where(ord => ord.CustId == find.CustId).ToList();

            return(searchResults);
        }
        public void runStore()
        {
            DbStoreContext db     = new DbStoreContext(); // set up dbcontext
            bool           broken = true;                 // bool to get us out of loop
            ConsoleKey     input;                         // intial console key

            //Menu options
            string[] menu = new string[] { "Create new order", "Create new user",
                                           "Search User by name", "Look up your Order history", "Update inventory",
                                           "Create new product", "Look up location order history", "Exit Program" };
            Console.WriteLine("Welcome to the Outdoor Store");

            do
            {
                //loop through menu options
                for (int i = 0; i < menu.Length; i++)
                {
                    int num = i + 1;
                    Console.WriteLine(num + " " + menu[i]);
                }
                input = Console.ReadKey().Key;

                //Create Order
                if (input == ConsoleKey.D1)
                {   //initialize order
                    Order newOrder = createOrder();
                    //check that it is not null
                    if (newOrder == null)
                    {
                        Console.WriteLine();
                        Console.WriteLine($"Order cancelled.");
                    }

                    else if (newOrder != null)
                    {// Add new Order to the db
                        newOrder.OrderTime = DateTime.Now;
                        db.Add(newOrder);

                        db.SaveChanges();
                        Console.WriteLine();
                        Console.WriteLine($"Order added as order {newOrder.OrderID}");
                    }
                }



                //Create user
                else if (input == ConsoleKey.D2)
                {
                    newUser = createNewUser();
                    Console.WriteLine("Her is you User ID: " + newUser.CustId);
                }
                //User search
                else if (input == ConsoleKey.D3)
                {
                    List <Cust> searchResults = findUser();
                    if (searchResults.Count >= 1)
                    {
                        foreach (Cust p in searchResults)
                        {
                            //Print results
                            p.PrintUserInfo();
                        }
                    }
                    else
                    {
                        Console.WriteLine("Loooks like nothing came up." +
                                          " Try to create a new user!");
                        Console.WriteLine();
                    }
                }
                //Location search
                else if (input == ConsoleKey.D4)
                {
                    List <Order> searchResults = findUserOrderHistory();


                    if (searchResults.Count >= 1)
                    {
                        //loop through to include product name
                        for (int i = 0; i < searchResults.Count; i++)
                        {
                            List <Product> hold = db.Product.Where(prod => prod.ProductID == searchResults[i].Productid).ToList();
                            Console.WriteLine(searchResults[i].ToString() + hold[i].Name);
                        }
                    }
                    else
                    {
                        Console.WriteLine("Loooks like nothing came up." +
                                          " Try to create a new Order!");
                        Console.WriteLine();
                    }
                }
                //Adjust inventory
                else if (input == ConsoleKey.D5)
                {
                    adjustInventory();
                    //Update inventory
                }
                //create new Product
                else if (input == ConsoleKey.D6)
                {
                    createProduct();
                }
                //StoreLocation order history
                else if (input == ConsoleKey.D7)
                {
                    List <Order> searchResults = findLocalOrderHistory();


                    if (searchResults.Count >= 1)
                    {
                        //loops through to print out product names
                        for (int i = 0; i < searchResults.Count; i++)
                        {
                            List <Product> hold = db.Product.Where(prod => prod.ProductID == searchResults[i].Productid).ToList();
                            Console.WriteLine(searchResults[i].ToString() + hold[i].Name);
                        }
                    }
                    else
                    {
                        Console.WriteLine("Loooks like nothing came up." +
                                          " Try to create a new order!");
                        Console.WriteLine();
                    }
                }

                //exit the loop

                else if (input == ConsoleKey.D8)
                {
                    broken = false;
                    Console.WriteLine();
                    Console.WriteLine(broken);
                }


                else
                {
                    Console.WriteLine(broken);
                    Console.WriteLine("Whoops. Please press a valid key");
                }
            } while (broken == true);
        }