Пример #1
0
        public static void Show()
        {
            IngredientController controller = new IngredientController();
            IngredientsDataAcess ingredient = new IngredientsDataAcess();

            Console.Write("Ingredient ID:\n");
            int id = Int32.Parse(Console.ReadLine());

            ingredient = controller.FindById(id);

            Console.WriteLine(ingredient.ToString());

            Console.WriteLine($"New name: (leave blank for no change) ({ingredient.Name})");
            string name = Console.ReadLine();

            if (!String.IsNullOrEmpty(name))
            {
                ingredient.Name = name;
            }

            Console.WriteLine($"New stock quantity: (leave blank for no change) ({ingredient.Stock})");
            string stockStr = Console.ReadLine();

            if (!String.IsNullOrEmpty(stockStr))
            {
                int stock = Int32.Parse(stockStr);
                ingredient.Stock = stock;
            }

            controller.Update(ingredient);

            Console.WriteLine("\nIngredient updated!\n");
            Console.ReadKey();
            ClearHelper.Clear();
        }
        private static void SearchByName()
        {
            ClearHelper.Clear();
            Console.WriteLine("Ingredients Search\n");
            Console.WriteLine("Search by Name:");
            string name = Console.ReadLine();

            Console.WriteLine("\nFetching Data, please wait...");
            List <IngredientsDataAcess> ingredients = controller.FindByName(name);

            Console.WriteLine();

            if (ingredients.Count == 0)
            {
                Console.WriteLine($"There is no Ingredient with this Name");
            }
            else
            {
                foreach (IngredientsDataAcess ingredient in ingredients)
                {
                    Console.WriteLine(ingredient.ToString());
                }
            }

            Console.ReadKey();
            ClearHelper.Clear();
        }
        private static void SearchByName()
        {
            ClearHelper.Clear();
            Console.WriteLine("Addresses Search\n");
            Console.WriteLine("Search by Name:");
            string name = Console.ReadLine();

            Console.WriteLine("\nFetching Data, please wait...");
            List <AddressesDataAcess> Addresses = controller.FindByName(name);

            Console.WriteLine();

            if (Addresses.Count == 0)
            {
                Console.WriteLine($"There is no Address with this Street");
            }
            else
            {
                foreach (AddressesDataAcess Address in Addresses)
                {
                    Console.WriteLine(Address.ToString());
                }
            }

            Console.ReadKey();
            ClearHelper.Clear();
        }
        public static void Show()
        {
            CustomerController controller = new CustomerController();
            CustomersDataAcess customer   = new CustomersDataAcess();

            Console.Write("Customer ID:\n");
            int id = Int32.Parse(Console.ReadLine());

            customer = controller.FindById(id);

            Console.WriteLine(customer.ToString());

            Console.WriteLine($"New First Name: (leave blank for no change) ({customer.FirstName})");
            string firstName = Console.ReadLine();

            if (!String.IsNullOrEmpty(firstName))
            {
                customer.FirstName = firstName;
            }

            Console.WriteLine($"New Last Name: (leave blank for no change) ({customer.LastName})");
            string lastName = Console.ReadLine();

            if (!String.IsNullOrEmpty(lastName))
            {
                customer.LastName = lastName;
            }

            controller.Update(customer);

            Console.WriteLine("\nCustomer updated!\n");
            Console.ReadKey();
            ClearHelper.Clear();
        }
        private static void SearchByName()
        {
            ClearHelper.Clear();
            Console.WriteLine("Customers Search\n");
            Console.WriteLine("Search by Name:");
            string name = Console.ReadLine();

            Console.WriteLine("\nFetching Data, please wait...");
            List <CustomersDataAcess> customers = controller.FindByName(name);

            Console.WriteLine();

            if (customers.Count == 0)
            {
                Console.WriteLine($"There is no Customer with this Name");
            }
            else
            {
                foreach (CustomersDataAcess customer in customers)
                {
                    Console.WriteLine(customer.ToString());
                }
            }

            Console.ReadKey();
            ClearHelper.Clear();
        }
        public static void Show()
        {
            Console.WriteLine("Fetching Data, please wait...");

            IngredientController        controller = new IngredientController();
            List <IngredientsDataAcess> list       = controller.getAll();

            ClearHelper.Clear();
            Console.WriteLine("Ingredients:\n");

            foreach (IngredientsDataAcess ingredient in list)
            {
                Console.WriteLine(ingredient.ToString());
            }
        }
Пример #7
0
        public static void Show()
        {
            IngredientsDataAcess ingredient = new IngredientsDataAcess();

            Console.Write("Ingredient ID:\n");
            int id = Int32.Parse(Console.ReadLine());

            IngredientController controller = new IngredientController();

            controller.Delete(id);

            Console.WriteLine("\nIngredient deleted!\n");
            Console.ReadKey();
            ClearHelper.Clear();
        }
Пример #8
0
        public static void Show()
        {
            Console.WriteLine("Fetching Data, please wait...");

            CustomerController        controller = new CustomerController();
            List <CustomerDataAccess> list       = controller.getAll(false);

            ClearHelper.Clear();
            Console.WriteLine("Customers:\n");

            foreach (CustomerDataAccess customer in list)
            {
                Console.WriteLine(customer.ToString());
            }
        }
        public static void Show()
        {
            Console.WriteLine("Fetching Data, please wait...");

            PizzaController        controller = new PizzaController();
            List <PizzasDataAcess> list       = controller.GetAllWithIngredients();

            ClearHelper.Clear();
            Console.WriteLine("Pizzas:\n");

            foreach (PizzasDataAcess Pizza in list)
            {
                Console.WriteLine(Pizza.ToString());
            }
        }
Пример #10
0
        public static void Show()
        {
            Console.WriteLine("Fetching Data, please wait...");

            AddressController          addressController = new AddressController();
            List <AddressesDataAccess> addressList       = addressController.getAll();
            AddressesDataAccess        address           = null;

            int addressId = 0;

            do
            {
                ClearHelper.Clear();
                Console.WriteLine("Show all Orders by Customer\n");

                //Show all customers
                foreach (AddressesDataAccess a in addressList)
                {
                    Console.WriteLine(a.ToString());
                }

                //Select Customer
                Console.WriteLine("\nSelect Address:\n");
                addressId = Int32.Parse(Console.ReadLine());
                address   = addressController.FindById(addressId);

                if (address == null)
                {
                    Console.WriteLine("\nWrong Address Id");
                    Console.ReadKey();
                }

                ClearHelper.Clear();
            } while (address == null);

            OrderController        controller = new OrderController();
            List <OrderDataAccess> orders     = controller.FindByAddress(address.Id);

            orders = SortForm.Sort(orders);

            ClearHelper.Clear();
            Console.WriteLine($"{address.Address1}'s Orders:\n");

            foreach (OrderDataAccess order in orders)
            {
                Console.WriteLine(order.ToString());
            }
        }
Пример #11
0
        public static void Show()
        {
            Console.WriteLine("Fetching Data, please wait...");

            CustomerController        customerController = new CustomerController();
            List <CustomerDataAccess> customersList      = customerController.getAll();
            CustomerDataAccess        customer           = null;
            int customerId = 0;

            do
            {
                ClearHelper.Clear();
                Console.WriteLine("Show all Orders by Customer\n");

                //Show all customers
                foreach (CustomerDataAccess c in customersList)
                {
                    Console.WriteLine(c.ToString());
                }

                //Select Customer
                Console.WriteLine("\nSelect Customer:\n");
                customerId = Int32.Parse(Console.ReadLine());
                customer   = customerController.FindById(customerId);

                if (customer == null)
                {
                    Console.WriteLine("\nWrong Customer Id");
                    Console.ReadKey();
                }

                ClearHelper.Clear();
            } while (customer == null);

            OrderController        controller = new OrderController();
            List <OrderDataAccess> orders     = controller.FindByCustomer(customer.Id);

            orders = SortForm.Sort(orders);

            ClearHelper.Clear();
            Console.WriteLine($"{customer.FirstName} {customer.LastName}'s Orders:\n");

            foreach (OrderDataAccess order in orders)
            {
                Console.WriteLine(order.ToString());
            }
        }
        public static void Show()
        {
            Console.WriteLine("Fetching Data, please wait...");

            OrderController        controller = new OrderController();
            List <OrdersDataAcess> list       = controller.getAll();

            list = SortForm.Sort(list);

            ClearHelper.Clear();
            Console.WriteLine("Orders:\n");

            foreach (OrdersDataAcess order in list)
            {
                Console.WriteLine(order.ToString());
            }
        }
Пример #13
0
        public static void ShowForm()
        {
            IngredientsDataAcess ingredient = new IngredientsDataAcess();

            Console.Write("Ingrediente Name:\n");
            ingredient.Name = Console.ReadLine();

            Console.Write("Quantity in Stock:\n");
            ingredient.Stock = Int32.Parse(Console.ReadLine());

            IngredientController controller = new IngredientController();

            controller.Save(ingredient);

            Console.WriteLine("\nIngredient saved!\n");
            Console.ReadKey();
            ClearHelper.Clear();
        }
Пример #14
0
        public static List <OrdersDataAcess> Sort(List <OrdersDataAcess> list)
        {
            string menuOption = new string("");
            string menu       = "Sort by:\n\n" +
                                "1 - Earliest First\n" +          //Older First
                                "2 - Latest First\n" +            //Newer Fisrt
                                "3 - Cheapest First\n" +          //Cheapest First
                                "4 - Most Expensive First\n" +    //Most Expensive First
                                "Option: ";

            do
            {
                Console.Write(menu);
                menuOption = Console.ReadLine();

                switch (menuOption)
                {
                case "1":
                    list = list.OrderBy(m => m.Date).ToList();
                    break;

                case "2":
                    list = list.OrderByDescending(m => m.Date).ToList();
                    break;

                case "3":
                    list = list.OrderBy(m => m.Value).ToList();
                    break;

                case "4":
                    list = list.OrderByDescending(m => m.Value).ToList();
                    break;

                default:
                    Console.WriteLine("Wrong option!");
                    Console.ReadKey();
                    ClearHelper.Clear();
                    break;
                }
            } while (menuOption != "1" && menuOption != "2" && menuOption != "3" && menuOption != "4");

            return(list);
        }
        public static void ShowForm()
        {
            CustomerController controller = new CustomerController();
            CustomerDataAccess customer   = new CustomerDataAccess();
            AddressDataAccess  address    = new AddressDataAccess();

            Console.Write("Customer First Name:\n");
            customer.FirstName = Console.ReadLine();

            Console.Write("Customer Last Name:\n");
            customer.LastName = Console.ReadLine();

            Console.Write("Address Line 1:\n");
            address.Address1 = Console.ReadLine();

            Console.Write("Address Line 2:\n");
            address.Address2 = Console.ReadLine();

            Console.Write("City:\n");
            address.City = Console.ReadLine();

            do
            {
                Console.Write("State: (2 letters)\n");
                address.State = Console.ReadLine();
            } while (address.State.Length != 2);

            Console.Write("ZipCode:\n");
            address.Zipcode = Int32.Parse(Console.ReadLine());

            customer.Addresses.Add(address);
            controller.Save(customer);

            Console.WriteLine("\nCustomer saved!\n");
            Console.ReadKey();
            ClearHelper.Clear();
        }
        private static void SearchById()
        {
            ClearHelper.Clear();
            Console.WriteLine("Ingredients Search\n");
            Console.WriteLine("Search by ID:");
            int id = Int32.Parse(Console.ReadLine());

            Console.WriteLine("\nFetching Data, please wait...");
            IngredientsDataAcess ingredient = controller.FindById(id);

            Console.WriteLine();

            if (ingredient == null)
            {
                Console.WriteLine($"There is no Ingredient with this Id");
            }
            else
            {
                Console.WriteLine(ingredient.ToString());
            }

            Console.ReadKey();
            ClearHelper.Clear();
        }
        private static void SearchById()
        {
            ClearHelper.Clear();
            Console.WriteLine("Address Search\n");
            Console.WriteLine("Search by ID:");
            int id = Int32.Parse(Console.ReadLine());

            Console.WriteLine("\nFetching Data, please wait...");
            AddressesDataAcess Address = controller.FindById(id);

            Console.WriteLine();

            if (Address == null)
            {
                Console.WriteLine($"There is no Address with this Id");
            }
            else
            {
                Console.WriteLine(Address.ToString());
            }

            Console.ReadKey();
            ClearHelper.Clear();
        }
        public static void Search()
        {
            string menuOption = new string("");
            string menu       = "Customers Search\n\n" +
                                "1 - Search by ID\n" +
                                "2 - Search by Name\n" +
                                "b - Back\n" +
                                "Option: ";

            do
            {
                Console.Write(menu);
                menuOption = Console.ReadLine();

                switch (menuOption)
                {
                case "1":
                    SearchById();
                    break;

                case "2":
                    SearchByName();
                    break;

                case "b":
                    ClearHelper.Clear();
                    break;

                default:
                    Console.WriteLine("Wrong option!");
                    Console.ReadKey();
                    ClearHelper.Clear();
                    break;
                }
            } while (menuOption != "b");
        }
        private static void SearchById()
        {
            ClearHelper.Clear();
            Console.WriteLine("Customers Search\n");
            Console.WriteLine("Search by ID:");
            int id = Int32.Parse(Console.ReadLine());

            Console.WriteLine("\nFetching Data, please wait...");
            CustomersDataAcess customer = controller.FindById(id, true);

            Console.WriteLine();

            if (customer == null)
            {
                Console.WriteLine($"There is no Customer with this Id");
            }
            else
            {
                Console.WriteLine(customer.ToString());
            }

            Console.ReadKey();
            ClearHelper.Clear();
        }
Пример #20
0
        public static void ShowForm()
        {
            Console.WriteLine("Fetching Data, please wait...");

            OrderController orderController = new OrderController();
            OrderDataAccess order           = new OrderDataAccess();

            //Customer
            CustomerController        customerController = new CustomerController();
            List <CustomerDataAccess> customersList      = customerController.getAll();
            CustomerDataAccess        customer           = null;
            int customerId = 0;

            do
            {
                ClearHelper.Clear();
                Console.WriteLine("New Order\n");

                //Show all customers
                foreach (CustomerDataAccess c in customersList)
                {
                    Console.WriteLine(c.ToString());
                }

                //Select Customer
                Console.WriteLine("\nSelect Customer:\n");
                customerId = Int32.Parse(Console.ReadLine());
                customer   = customerController.FindById(customerId);

                if (customer == null)
                {
                    Console.WriteLine("\nWrong Customer Id");
                    Console.ReadKey();
                }

                ClearHelper.Clear();
            } while (customer == null);

            order.CustomerId = customer.Id;

            //Customer Address
            Console.WriteLine("Fetching Customer Addresses, please wait...");

            AddressController          addressController = new AddressController();
            List <AddressesDataAccess> addresses         = addressController.FindByCustomerId(customer.Id);
            AddressesDataAccess        address           = null;
            int  addressId    = 0;
            bool validAddress = false;

            do
            {
                ClearHelper.Clear();
                Console.WriteLine("Customer Address\n");

                //Show all customers
                foreach (AddressesDataAccess a in addresses)
                {
                    Console.WriteLine(a.ToString());
                }

                //Select Customer
                Console.WriteLine("\nSelect Customer's Address:\n");
                addressId = Int32.Parse(Console.ReadLine());
                address   = addressController.FindById(addressId);

                if (address == null)
                {
                    Console.WriteLine("\nWrong Customer Address's Id");
                    Console.ReadKey();
                }

                Console.WriteLine("\nChecking last order from this address. Please wait!\n");
                DateTime lastOrder = orderController.getLastOrderDate(address.Id);

                if (order.canOrderFromSameAddress(lastOrder) == true)
                {
                    order.AddressId = addressId;
                    validAddress    = true;
                }
                else
                {
                    Console.WriteLine("It's been less then 2 hours from the last order from this address");
                    Console.ReadKey();
                }
            } while (validAddress != true);

            //Pizzas
            Console.WriteLine("Fetching Pizzas, please wait...");

            PizzaController        pizzaController = new PizzaController();
            List <PizzaDataAccess> pizzas          = pizzaController.getAll();
            List <PizzaDataAccess> suggestedPizzas = orderController.getSuggestedPizzas(customer.Id);
            PizzaDataAccess        pizza           = null;
            string pizzaOption = null;
            int    pizzaId     = 0;

            do
            {
                pizzas = null;
                pizzas = pizzaController.getAll();

                ClearHelper.Clear();
                Console.WriteLine("Adding Pizzas to Order\n");

                //Show all pizzas
                foreach (PizzaDataAccess p in pizzas)
                {
                    //Cannot use Console.WriteLine(p.ToString()); because after adding a pizza to order, it shows the pizza's ingredient, don't know why
                    Console.WriteLine($"ID: {p.Id} - {p.Name} {Convert.ToDecimal(string.Format("{0:0,00.00}", p.Price))}");
                }

                //Suggested Pizzas
                Console.WriteLine("\n***SUGGESTED PIZZAS***");
                foreach (PizzaDataAccess sp in suggestedPizzas)
                {
                    Console.WriteLine(sp.ToString());
                }
                Console.WriteLine("***END SUGGESTED PIZZAS***");

                Console.WriteLine("\nd - Done");

                //Select pizza
                Console.WriteLine("\nSelect Pizza's Id:\n");
                pizzaOption = Console.ReadLine();

                bool pizzaOptionIsNumber = int.TryParse(pizzaOption, out pizzaId);

                //If pizzaOption is number get pizza
                if (pizzaOptionIsNumber == true)
                {
                    pizza = pizzaController.FindById(pizzaId);

                    if (pizza == null)
                    {
                        Console.WriteLine("\nWrong Pizza's Id");
                        Console.ReadKey();
                    }

                    bool checkStock       = true;
                    bool canAddMorePizzas = true;

                    //Check Stock
                    if (pizzaController.CheckStock(pizza) == true)
                    {
                        canAddMorePizzas = order.AddPizza(pizza);

                        //Cannot add more pizzas, then pizza Option = "d" for DONE, to stop while
                        if (canAddMorePizzas == false)
                        {
                            pizzaOption = "d";
                        }
                        else
                        {
                            pizzaController.DecreaseStock(pizza);
                            Console.WriteLine($"Pizza {pizza.Id} added!");
                            Console.ReadKey();
                        }
                    }
                    else
                    {
                        Console.WriteLine("Cannot add this pizza, Pizza's Ingredient stock is low");
                        Console.ReadKey();
                    }
                }
                //else, check if is "d" for Done
                else if (pizzaOption != "d")
                {
                    Console.WriteLine("Wrong option");
                }
            } while (pizzaOption != "d");

            order.Date = DateTime.Now;
            orderController.Save(order);

            Console.WriteLine("\nOrder saved!\n");
            Console.ReadKey();
            ClearHelper.Clear();
        }
Пример #21
0
        public static void Show()
        {
            AddressController  controller = new AddressController();
            AddressesDataAcess address    = new AddressesDataAcess();

            Console.Write("Address ID:\n");
            int id = Int32.Parse(Console.ReadLine());

            address = controller.FindById(id);

            Console.WriteLine($"Address: {address.ToString()}\n");

            Console.WriteLine("Update Address\n");

            Console.Write($"Address Line 1: (leave blank for no change) ({address.Address1})\n");
            string address1 = Console.ReadLine();

            if (!String.IsNullOrEmpty(address1))
            {
                address.Address1 = address1;
            }

            Console.Write($"Address Line 2: (leave blank for no change) ({address.Address2})\n");
            string address2 = Console.ReadLine();

            if (!String.IsNullOrEmpty(address2))
            {
                address.Address2 = address2;
            }

            Console.Write($"City: (leave blank for no change) ({address.City})\n");
            string city = Console.ReadLine();

            if (!String.IsNullOrEmpty(city))
            {
                address.City = city;
            }

            string state = null;

            do
            {
                Console.Write($"State: (2 letters): (leave blank for no change) ({address.State})\n");
                state = Console.ReadLine();
            } while (state.Length != 2 || String.IsNullOrEmpty(state));
            if (!String.IsNullOrEmpty(state))
            {
                address.State = state;
            }

            Console.Write($"ZipCode: (leave blank for no change) ({address.Zipcode})\n");
            string zipcode = Console.ReadLine();

            if (!String.IsNullOrEmpty(zipcode))
            {
                address.Zipcode = Int32.Parse(zipcode);
            }

            controller.Update(address);

            Console.WriteLine("\nAddress updated!\n");
            Console.ReadKey();
            ClearHelper.Clear();
        }
Пример #22
0
        public static void ShowForm()
        {
            PizzasDataAcess pizza = new PizzasDataAcess();

            Console.Write("Pizza Name:\n");
            pizza.Name = Console.ReadLine();

            Console.Write("Pizza Price:\n");
            pizza.Price = Decimal.Parse(Console.ReadLine());

            Console.WriteLine("Retrieving Ingredients, please wait...\n");

            IngredientController        ingredientController = new IngredientController();
            List <IngredientsDataAcess> ingredientsList      = ingredientController.getAll();

            string option = "";

            do
            {
                Console.WriteLine();
                //Show all Ingredientes
                foreach (IngredientsDataAcess ingredient in ingredientsList)
                {
                    Console.WriteLine($"Ingredient ID: {ingredient.Id} - {ingredient.Name}");
                }
                Console.WriteLine("\nd - Done");

                Console.Write("\nIngredient ID:\n");
                option = Console.ReadLine();
                int ingredientId = 0;

                //if is integer
                if (int.TryParse(option, out ingredientId))
                {
                    IngredientsDataAcess ingredientSearch = ingredientController.FindById(ingredientId);

                    //If Ingredient exists with this ID
                    if (ingredientSearch != null)
                    {
                        pizza.PizzasIngredients.Add(new PizzasIngredientsDataAcess()
                        {
                            IngredientId = ingredientSearch.Id
                        });
                    }
                    //Not existis ingredients
                    else
                    {
                        Console.WriteLine("Invalid ID!");
                        Console.ReadKey();
                        ClearHelper.Clear();
                    }
                }
                //Not Integer, if is option d
                else if (option != "d")
                {
                    Console.WriteLine("Wrong Id or \"d\" for done");
                    Console.ReadKey();
                    ClearHelper.Clear();
                }
            } while (option != "d");


            PizzaController controller = new PizzaController();

            controller.Save(pizza);

            Console.WriteLine("\nPizza saved!\n");
            Console.ReadKey();
            ClearHelper.Clear();
        }
        public static void Show()
        {
            PizzaController controller = new PizzaController();
            PizzasDataAcess Pizza      = new PizzasDataAcess();

            Console.Write("Pizza ID:\n");
            int id = Int32.Parse(Console.ReadLine());

            Pizza = controller.FindById(id);

            Console.WriteLine(Pizza.ToString());

            Console.WriteLine($"New name: (leave blank for no change) ({Pizza.Name})");
            string name = Console.ReadLine();

            if (!String.IsNullOrEmpty(name))
            {
                Pizza.Name = name;
            }

            Console.WriteLine($"New price: (leave blank for no change) ({Convert.ToDecimal(string.Format("{0:0,00.00}", Pizza.Price))})");
            string priceString = Console.ReadLine();

            if (!String.IsNullOrEmpty(priceString))
            {
                decimal price = Decimal.Parse(priceString);
                Pizza.Price = price;
            }

            string option = "";

            //Old Ingredients
            List <PizzasIngredients> newIngredients = new List <PizzasIngredients>();

            foreach (PizzasIngredients pizzaIngredients in Pizza.PizzasIngredients)
            {
                option = "";
                IngredientsDataAcess i = pizzaIngredients.Ingredient;

                do
                {
                    Console.WriteLine($"Ingredient ID:{i.Id} - {i.Name}");
                    Console.WriteLine("k - Keep; d - Delete");
                    option = Console.ReadLine();

                    switch (option)
                    {
                    case "k":
                        newIngredients.Add(new PizzasIngredients()
                        {
                            PizzaId = Pizza.Id, IngredientId = i.Id
                        });
                        break;

                    case "d":
                        break;

                    default:
                        Console.WriteLine("Wrong Option");
                        break;
                    }
                } while (option != "k" && option != "d");
            }

            Console.WriteLine("Retrieving Ingredients, please wait...\n");

            IngredientController        ingredientController = new IngredientController();
            List <IngredientsDataAcess> ingredientsList      = ingredientController.getAll();

            option = "";
            do
            {
                Console.WriteLine();
                //Show all Ingredientes
                foreach (IngredientsDataAcess ingredient in ingredientsList)
                {
                    Console.WriteLine($"Ingredient ID: {ingredient.Id} - {ingredient.Name}");
                }
                Console.WriteLine("\nd - Done");

                Console.Write("\nIngredient ID:\n");
                option = Console.ReadLine();
                int ingredientId = 0;

                //if is integer
                if (int.TryParse(option, out ingredientId))
                {
                    IngredientsDataAcess ingredientSearch = ingredientController.FindById(ingredientId);

                    //If Ingredient exists with this ID
                    if (ingredientSearch != null)
                    {
                        newIngredients.Add(new PizzasIngredients()
                        {
                            PizzaId = Pizza.Id, IngredientId = ingredientSearch.Id
                        });
                    }
                    //Not existis ingredients
                    else
                    {
                        Console.WriteLine("Invalid ID!");
                        Console.ReadKey();
                        ClearHelper.Clear();
                    }
                }
                //Not Integer, if is option d
                else if (option != "d")
                {
                    Console.WriteLine("Wrong Id or \"d\" for done");
                    Console.ReadKey();
                    ClearHelper.Clear();
                }
            } while (option != "d");

            //Add INgredients to pizza
            Pizza.PizzasIngredients = new List <PizzasIngredients>();
            Pizza.PizzasIngredients = newIngredients;
            controller.Update(Pizza);

            Console.WriteLine("\nPizza updated!\n");
            Console.ReadKey();
            ClearHelper.Clear();
        }
        public static void ShowForm()
        {
            Console.WriteLine("Fetching Data, please wait...");

            AddressController controller = new AddressController();
            //AddressDataAccess customer = new AddressDataAccess();
            AddressesDataAccess address = new AddressesDataAccess();

            CustomerController        customerController = new CustomerController();
            List <CustomerDataAccess> customersList      = customerController.getAll();
            CustomerDataAccess        customer           = null;
            int customerId = 0;

            do
            {
                ClearHelper.Clear();
                Console.WriteLine("New Address\n");

                //Show all customers
                foreach (CustomerDataAccess c in customersList)
                {
                    Console.WriteLine(c.ToString());
                }

                //Select Customer
                Console.WriteLine("\nSelect Customer to add address:\n");
                customerId = Int32.Parse(Console.ReadLine());
                customer   = customerController.FindById(customerId);

                if (customer == null)
                {
                    Console.WriteLine("\nWrong Customer Id");
                    Console.ReadKey();
                }

                ClearHelper.Clear();
            } while (customer == null);

            address.CustomerId = customerId;

            //New Address
            Console.WriteLine("New Address");
            Console.WriteLine($"Customer: {customer.ToString()}\n");

            Console.Write("Address Line 1:\n");
            address.Address1 = Console.ReadLine();

            Console.Write("Address Line 2:\n");
            address.Address2 = Console.ReadLine();

            Console.Write("City:\n");
            address.City = Console.ReadLine();

            do
            {
                Console.Write("State: (2 letters)\n");
                address.State = Console.ReadLine();
            } while (address.State.Length != 2);

            Console.Write("ZipCode:\n");
            address.Zipcode = Int32.Parse(Console.ReadLine());

            controller.Save(address);

            Console.WriteLine("\nAddress saved!\n");
            Console.ReadKey();
            ClearHelper.Clear();
        }
        public static void ShowForm()
        {
            Console.WriteLine("Fetching Data, please wait...");

            //Customer
            CustomerController        customerController = new CustomerController();
            List <CustomerDataAccess> customersList      = customerController.getAll();
            CustomerDataAccess        customer           = null;
            int customerId = 0;

            do
            {
                ClearHelper.Clear();
                Console.WriteLine("Set Default Address\n");

                //Show all customers
                foreach (CustomerDataAccess c in customersList)
                {
                    Console.WriteLine(c.ToString());
                }

                //Select Customer
                Console.WriteLine("\nSelect Customer:\n");
                customerId = Int32.Parse(Console.ReadLine());
                customer   = customerController.FindById(customerId);

                if (customer == null)
                {
                    Console.WriteLine("\nWrong Customer Id");
                    Console.ReadKey();
                }

                ClearHelper.Clear();
            } while (customer == null);

            AddressController          addressController = new AddressController();
            List <AddressesDataAccess> addresses         = addressController.FindByCustomerId(customer.Id);
            AddressesDataAccess        address           = null;
            int addressId = 0;

            do
            {
                ClearHelper.Clear();
                Console.WriteLine("Set Default Address\n");

                //Show all customers
                foreach (AddressesDataAccess a in addresses)
                {
                    Console.WriteLine(a.ToString());
                }

                //Select Customer
                Console.WriteLine("\nSelect Default Address:\n");
                addressId = Int32.Parse(Console.ReadLine());
                address   = addressController.FindById(addressId);

                if (address == null)
                {
                    Console.WriteLine("\nWrong Address Id");
                    Console.ReadKey();
                }
            } while (address == null);

            addressController.SetDefaultAddress(address.Id, customer.Id);

            Console.WriteLine("Default Address saved!\n");
        }