static void DeleteDepartment(Controller.DepartmentController departmentController)
        {
            Console.WriteLine("Id of the department");
            int id = Convert.ToInt32(Console.ReadLine());

            departmentController.Delete(id);
        }
        static void UpdateDepartment(Controller.DepartmentController departmentController)
        {
            Console.WriteLine("--------------------------------------");
            Console.WriteLine("Id of the Department");
            Console.WriteLine("--------------------------------------");
            int id = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("--------------------------------------");

            Console.WriteLine("Name?");
            Console.WriteLine("--------------------------------------");
            string name = Console.ReadLine();

            Console.WriteLine("--------------------------------------");

            Console.WriteLine("Description?");
            Console.WriteLine("--------------------------------------");
            string description = Console.ReadLine();

            Console.WriteLine("--------------------------------------");

            Console.WriteLine("CompanyId?");
            Console.WriteLine("--------------------------------------");
            int CompanId = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("--------------------------------------");


            departmentController.Update(id, name, description, CompanId);
        }
        static void ReadDepartment(Controller.DepartmentController departmentController)
        {
            List <ConsoleApp.Model.Department> departments = departmentController.ReadDapper();

            //List<ConsoleApp.Model.Company> companies = companyController.Read();


            Console.WriteLine("".PadRight(78, '-'));
            Console.WriteLine($"| {"Id".PadRight(8)} | {"Name".PadRight(16)} | {"Description".PadRight(32)} | {"CompanyName".PadRight(16)} |");
            Console.WriteLine("".PadRight(78, '-'));
            for (int i = 0; i < departments.Count; i++)
            {
                Console.WriteLine($"| {departments[i].Id.ToString().PadRight(8)} | {departments[i].Name.PadRight(16)} | {departments[i].Description.PadRight(32)} | {departments[i].Name.PadRight(16)} |");
            }
            Console.WriteLine("".PadRight(78, '-'));
        }
        static void CreateDepartment(Controller.DepartmentController departmentController)
        {
            Console.WriteLine("--------------------------------------");
            Console.WriteLine("Name?");
            Console.WriteLine("--------------------------------------");
            string name = Console.ReadLine();

            Console.WriteLine("--------------------------------------");
            Console.WriteLine("Description?");
            Console.WriteLine("--------------------------------------");
            string description = Console.ReadLine();


            Console.WriteLine("--------------------------------------");
            Console.WriteLine("CompanyId?");
            Console.WriteLine("--------------------------------------");
            int companyId = Convert.ToInt32(Console.ReadLine());


            departmentController.Create(name, description, companyId);
        }
        static void Main(string[] args)
        {
            CompanyController companyController = new CompanyController(CONNECTION_STRING);
            AddressController addressController = new AddressController(CONNECTION_STRING);

            Controller.EmployeeController   employeeController   = new Controller.EmployeeController(CONNECTION_STRING);
            Controller.DepartmentController departmentController = new Controller.DepartmentController(CONNECTION_STRING);

            Console.BackgroundColor = ConsoleColor.Red;
            Console.Clear();
            Console.ForegroundColor = ConsoleColor.White;

            Console.WriteLine("Choose an Option!");
            Console.WriteLine("-----------------");
            Console.WriteLine("1. Company!");
            Console.WriteLine("2. Employee!");
            Console.WriteLine("3. Address!");
            Console.WriteLine("4. Department!");
            Console.WriteLine("5. Close Window!");
            Console.WriteLine("-----------------");

            switch (Console.ReadLine())
            {
            case "1":
                Console.WriteLine("Choose an Option!");
                Console.WriteLine("-----------------");
                Console.WriteLine("1. Add a company !");
                Console.WriteLine("2. Read all companies!");
                Console.WriteLine("3. Update a company!");
                Console.WriteLine("4. Delete a company!");
                Console.WriteLine("5. Close window!");
                Console.WriteLine("-----------------");
                switch (Console.ReadLine())
                {
                case "1": CreateCompany(companyController); break;

                case "2": ReadCompanies(companyController); break;

                case "3": UpdateCompany(companyController); break;

                case "4": DeleteCompany(companyController); break;

                case "5": Environment.Exit(0); break;

                default: break;
                }
                Console.Write("Press any key to come back to the main menu...");
                Console.ReadKey();
                Main(args);
                break;

            case "2":
                Console.WriteLine("Choose an Option!");
                Console.WriteLine("-----------------");
                Console.WriteLine("1. Add a employee !");
                Console.WriteLine("2. Read all employees!");
                Console.WriteLine("3. Update a employee!");
                Console.WriteLine("4. Delete a employee!");
                Console.WriteLine("5. Close window!");
                Console.WriteLine("-----------------");
                switch (Console.ReadLine())
                {
                case "1": CreateEmployee(employeeController); break;

                case "2": ReadEmployees(employeeController); break;

                case "3": UpdateEmployee(employeeController); break;

                case "4": DeleteEmployee(employeeController); break;

                case "5": Environment.Exit(0); break;

                default: break;
                }
                Console.Write("Press any key to come back to the main menu...");
                Console.ReadKey();
                Main(args);
                break;

            case "3":
                Console.WriteLine("Choose an Option!");
                Console.WriteLine("-----------------");
                Console.WriteLine("1. Add an address !");
                Console.WriteLine("2. Read all address!");
                Console.WriteLine("3. Update an address!");
                Console.WriteLine("4. Delete an address!");
                Console.WriteLine("5. Close window!");
                Console.WriteLine("-----------------");
                switch (Console.ReadLine())
                {
                case "1": CreateAddress(addressController); break;

                case "2": ReadAddress(addressController); break;

                case "3": UpdateAddress(addressController); break;

                case "4": DeleteAddress(addressController); break;

                case "5": Environment.Exit(0); break;

                default: break;
                }
                Console.Write("Press any key to come back to the main menu...");
                Console.ReadKey();
                Main(args);
                break;

            case "4":
                Console.WriteLine("Choose an Option!");
                Console.WriteLine("-----------------");
                Console.WriteLine("1. Add a department!");
                Console.WriteLine("2. Read all department!");
                Console.WriteLine("3. Update an department!");
                Console.WriteLine("4. Delete an department!");
                Console.WriteLine("5. Close window!");
                Console.WriteLine("-----------------");
                switch (Console.ReadLine())
                {
                case "1": CreateDepartment(departmentController); break;

                case "2": ReadDepartment(departmentController); break;

                case "3": UpdateDepartment(departmentController); break;

                case "4": DeleteDepartment(departmentController); break;

                case "5": Environment.Exit(0); break;

                default: break;
                }
                Console.Write("Press any key to come back to the main menu...");
                Console.ReadKey();
                Main(args);
                break;

            case "5": Environment.Exit(0); break;

            default: break;
            }


            Console.Write("Press any key to come back to the main menu...");
            Console.ReadKey();
            Main(args);
        }