Exemple #1
0
 public UnitOfWork(PersonContext context)
 {
     _context = context;
     Adress   = new AdressRepository(_context);
     Cities   = new CityRepository(_context);
     Persons  = new PersonRepository(_context);
     Phones   = new PhoneRepository(_context);
 }
 public AccountController(CitizenUserRepository citizenUserRepository, IMapper mapper,
                          IWebHostEnvironment hostEnvironment, AdressRepository adressRepository, UserService userService)
 {
     this.citizenUserRepository = citizenUserRepository;
     this.mapper           = mapper;
     this.hostEnvironment  = hostEnvironment;
     this.adressRepository = adressRepository;
     this.userService      = userService;
 }
Exemple #3
0
        public IActionResult Index()
        {
            var models = AdressRepository
                         .GetAll()
                         .Select(x => Mapper.Map <AdressViewModel>(x))
                         .ToList();

            return(View(models));
        }
Exemple #4
0
        public IActionResult Add(AdressViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }

            var model = Mapper.Map <Adress>(viewModel);

            AdressRepository.Save(model);

            return(RedirectToAction("Index", "Adress"));
        }
Exemple #5
0
 public LifeService(IMapper mapper,
                    CitizenUserRepository citizenUserRepository,
                    AccidentRepository accidentRepository,
                    AdressRepository addressRepository,
                    RoleRepository roleRepository,
                    IHttpContextAccessor httpContextAccessor)
 {
     this.mapper = mapper;
     this.citizenUserRepository = citizenUserRepository;
     this.addressRepository     = addressRepository;
     this.roleRepository        = roleRepository;
     this.httpContextAccessor   = httpContextAccessor;
     this.accidentRepository    = accidentRepository;
 }
 public OrgManUnitOfWork(OrgManEntities context = null)
 {
     _context                                = context ?? new OrgManEntities();
     AdressRepository                        = new AdressRepository(_context);
     CommunicationTypeRepository             = new CommunicationTypeRepository(_context);
     CountryRepository                       = new CountryRepository(_context);
     LoginRepository                         = new LoginRepository(_context);
     MandatorRepository                      = new MandatorRepository(_context);
     PersonToMandatorRepository              = new GenericRepository <PersonToMandator>(_context);
     MeetingRepository                       = new MeetingRepository(_context);
     MemberInformationRepository             = new MemberInformationRepository(_context);
     MemberInformationToMembershipRepository = new MemberInformationToMembershipRepository(_context);
     MembershipRepository                    = new MembershipRepository(_context);
     PhoneRepository                         = new PhoneRepository(_context);
     EmailRepository                         = new EmailRepository(_context);
     SalutationRepository                    = new SalutationRepository(_context);
     IndividualPersonRepository              = new IndividualPersonRepository(_context);
     SystemPersonRepository                  = new GenericRepository <SystemPerson>(_context);
     PersonRepository                        = new GenericRepository <Person>(_context);
     AuthenticationRepository                = new AuthenticationRepository(_context);
     SessionRepository                       = new GenericRepository <Session>(_context);
 }
        static void Main(string[] args)
        {
            var listRepository =
                new CustomerRepositoryList();
            var newCustomer      = new SilverCustomer();
            var adressRepository = new AdressRepository();


            newCustomer.Id       = 5;
            newCustomer.Name     = "Gilberto";
            newCustomer.Email    = "*****@*****.**";
            newCustomer.Adresses = adressRepository.GetByAdressesById(5);

            listRepository.Save(newCustomer);
            var customers = listRepository.GetAll();


            //foreach(var customer in customers)
            //{
            //    System.Console.WriteLine(customer.Name);
            //}
        }
Exemple #8
0
 public LifeController(WebMazeContext context,
                       IMapper mapper,
                       AccidentRepository accidentRepository,
                       AdressRepository addressRepository,
                       CitizenUserRepository citizenUserRepository,
                       VictimRepository victimRepository,
                       HouseDestroyedInFireRepository houseDestroyedInFireRepository,
                       FireDetailRepository fireDetailRepository,
                       CriminalOffenceArticleRepository criminalOffenceArticleRepository,
                       CriminalOffenderRepository criminalOffenderRepository,
                       LifeService lifeService)
 {
     this.context                          = context;
     this.accidentRepository               = accidentRepository;
     this.addressRepository                = addressRepository;
     this.citizenUserRepository            = citizenUserRepository;
     this.victimRepository                 = victimRepository;
     this.fireDetailRepository             = fireDetailRepository;
     this.houseDestroyedInFireRepository   = houseDestroyedInFireRepository;
     this.criminalOffenceArticleRepository = criminalOffenceArticleRepository;
     this.criminalOffenderRepository       = criminalOffenderRepository;
     this.lifeService                      = lifeService;
     this.mapper = mapper;
 }
Exemple #9
0
        public static void Main(string[] args)
        {
            ClientRepository    clientRepository    = new ClientRepository();
            InventoryRepository inventoryRepository = new InventoryRepository();
            AdressRepository    adressRepository    = new AdressRepository();
            List <Order>        orders          = new List <Order>();
            ReportGenerator     reportGenerator = new ReportGenerator(clientRepository);

            int MainAction = -1;

            while (MainAction != 0)
            {
                Console.WriteLine("Do you want to modify: client data [1] - Inventory data [2] - Order data [3] " +
                                  "- Generate reports [4] - Exit [0]");
                MainAction = Convert.ToInt32(Console.ReadLine());
                if (MainAction == 1)
                {
                    Console.WriteLine("Do you want to add or delete client? [1] - Add new client, [2] - Delete client, " +
                                      "[3] - No changes in client's data");
                    int changeClientsData = Convert.ToInt32(Console.ReadLine());
                    int clientItemIndex   = 0;

                    if (changeClientsData == 1)
                    {
                        Console.WriteLine("Please enter clients ID");
                        int newClientsID = Convert.ToInt32(Console.ReadLine());
                        Console.WriteLine("Please enter clients Name");
                        string newClientsName = Console.ReadLine();
                        Console.WriteLine("Please enter clients Surname");
                        string newClientsSurname = Console.ReadLine();
                        Console.WriteLine("How do you want to enter Home adress? [1] " +
                                          "- Select adress ID from the list below, [2] - Add new adress");
                        foreach (var adress in adressRepository.Retrieve())
                        {
                            Console.WriteLine("Adress ID - {0}, City - {1}, Street - {2}", adress.AdressId, adress.City,
                                              adress.Street);
                        }

                        int adressSelectionOption = Convert.ToInt32(Console.ReadLine());
                        int homeAdressID          = 0;
                        if (adressSelectionOption == 1)
                        {
                            Console.WriteLine("Please enter home adress id from the list");
                            homeAdressID = Convert.ToInt32(Console.ReadLine());
                        }

                        else if (adressSelectionOption == 2)

                        {
                            Console.WriteLine("Please enter new adress Id");
                            homeAdressID = Convert.ToInt32(Console.ReadLine());

                            Console.WriteLine("Please enter new adress City");
                            string newadressCity = Console.ReadLine();

                            Console.WriteLine("Please enter new adress Street");
                            string newadressStreet = Console.ReadLine();

                            Console.WriteLine("Please enter new adress ZipCode");
                            int newadressZipCode = Convert.ToInt32(Console.ReadLine());

                            adressRepository.AddnewAdress(new ClientAdress(homeAdressID, newadressCity, newadressStreet,
                                                                           newadressZipCode));

                            foreach (var adress in adressRepository.Retrieve())
                            {
                                Console.WriteLine("Adress ID - {0}, City - {1}, Street - {2}", adress.AdressId, adress.City,
                                                  adress.Street);
                            }
                        }

                        Console.WriteLine("How do you want to enter Delivery adress? [1] " +
                                          "- Select adress ID from the list below, [2] - Add new adress");
                        foreach (var adress in adressRepository.Retrieve())
                        {
                            Console.WriteLine("Adress ID - {0}, City - {1}, Street - {2}", adress.AdressId, adress.City,
                                              adress.Street);
                        }

                        int deliveryadressSelectionOption = Convert.ToInt32(Console.ReadLine());
                        int deliveryAdressID = 0;
                        if (deliveryadressSelectionOption == 1)
                        {
                            Console.WriteLine("Please enter delivery adress id from the list");
                            deliveryAdressID = Convert.ToInt32(Console.ReadLine());
                        }

                        else if (deliveryadressSelectionOption == 2)

                        {
                            Console.WriteLine("Please enter new adress Id");
                            deliveryAdressID = Convert.ToInt32(Console.ReadLine());

                            Console.WriteLine("Please enter new adress City");
                            string newadressCity = Console.ReadLine();

                            Console.WriteLine("Please enter new adress Street");
                            string newadressStreet = Console.ReadLine();

                            Console.WriteLine("Please enter new adress ZipCode");
                            int newadressZipCode = Convert.ToInt32(Console.ReadLine());

                            adressRepository.AddnewAdress(new ClientAdress(deliveryAdressID, newadressCity, newadressStreet,
                                                                           newadressZipCode));

                            foreach (var adress in adressRepository.Retrieve())
                            {
                                Console.WriteLine("Adress ID - {0}, City - {1}, Street - {2}", adress.AdressId, adress.City,
                                                  adress.Street);
                            }
                        }

                        clientRepository.AddNewItem(new Client(newClientsID, newClientsName, newClientsSurname, homeAdressID, deliveryAdressID));

                        foreach (var cl in clientRepository.Retrieve())
                        {
                            Console.WriteLine("Client {0}, Name {1}, Home Adress id {2}, Delivery Adress id {3}:", cl.ClientID, cl.Name,
                                              cl.HomeAdressId, cl.DeliveryAdressId);
                        }
                    }

                    else if (changeClientsData == 2)
                    {
                        Console.WriteLine("Please select number of the client you want to delete from the list");
                        foreach (var cl in clientRepository.Retrieve())
                        {
                            Console.WriteLine("Item index: {1}, Client {0}", cl.ClientID, clientItemIndex);
                            clientItemIndex = clientItemIndex + 1;
                        }

                        int clientItemIndexToDelete = Convert.ToInt32(Console.ReadLine());

                        clientRepository.DeleteItem(clientItemIndexToDelete);

                        foreach (var cl in clientRepository.Retrieve())
                        {
                            Console.WriteLine("Client {0}, Name {1}, Home Adress id {2}, Delivery Adress id {3}:", cl.ClientID, cl.Name,
                                              cl.HomeAdressId, cl.DeliveryAdressId);
                        }
                    }
                }
                else if (MainAction == 2)
                {
                    Console.WriteLine("Do you want to add or delete inventory items? [1] - Add new item, [2] - Delete item, " +
                                      "[3] - No changes in inventory data");

                    int changeInventoryData = Convert.ToInt32(Console.ReadLine());
                    int inventoryItemIndex  = 0;

                    if (changeInventoryData == 1)
                    {
                        Console.WriteLine("Please enter item ID");
                        int newItemID = Convert.ToInt32(Console.ReadLine());
                        Console.WriteLine("Please enter item Name");
                        string newItemsName = Console.ReadLine();
                        Console.WriteLine("Please enter item price");
                        decimal newItemPrice = Convert.ToDecimal(Console.ReadLine());
                        inventoryRepository.AddnewInventory(new Inventory(newItemID, newItemsName, newItemPrice));

                        foreach (var inv in inventoryRepository.Retrieve())
                        {
                            Console.WriteLine("Inventory item {0}", inv.ItemId);
                        }
                    }

                    else if (changeInventoryData == 2)
                    {
                        Console.WriteLine("Please enter inventory index to delete inventory item from the list below");
                        foreach (var inv in inventoryRepository.Retrieve())
                        {
                            Console.WriteLine("Item index: {1}, Inventory Item {0}", inv.ItemId, inventoryItemIndex);
                            inventoryItemIndex = inventoryItemIndex + 1;
                        }
                        int inventoryItemIndexToDelete = Convert.ToInt32(Console.ReadLine());

                        inventoryRepository.DeleteItem(inventoryItemIndexToDelete);

                        foreach (var inv in inventoryRepository.Retrieve())
                        {
                            Console.WriteLine("Inventory item {0}", inv.ItemId);
                        }
                    }
                }
                else if (MainAction == 3)
                {
                    Console.WriteLine("Do you want to add a new order? [1] - Yes, [2] - Modify existing order stautus to unpaid, [3] - No");

                    int addNewOrder = Convert.ToInt32(Console.ReadLine());

                    if (addNewOrder == 1)
                    {
                        Order order = new Order();
                        order.Status = OrderStatus.Created;
                        order.Date   = DateTime.Now;

                        Console.WriteLine("Please enter Order's ID");
                        int ordersId = Convert.ToInt32(Console.ReadLine());

                        Console.WriteLine("Please enter Client's ID from the list below:");
                        foreach (var cl in clientRepository.Retrieve())
                        {
                            Console.WriteLine("Client {0}", cl.ClientID);
                        }
                        int clientsId = Convert.ToInt32(Console.ReadLine());

                        //Patikrint ar toks ID egzistuoja!
                        order.OrderId  = ordersId;
                        order.ClientId = clientsId;
                        orders.Add(order);
                        bool addInventory = true;
                        while (addInventory == true)
                        {
                            Console.WriteLine("Do you want to add new item to order? [1] - Add new item, [2] - Finish order");
                            int addItemToOrder = Convert.ToInt32(Console.ReadLine());
                            if (addItemToOrder == 1)
                            {
                                OrderItem orderItem = new OrderItem();

                                Console.WriteLine("Please select Item's Id from the list below:");
                                foreach (var inv in inventoryRepository.Retrieve())
                                {
                                    Console.WriteLine("Inventory item - {0}, Name - {1}, Price - {2}", inv.ItemId, inv.ItemName, inv.ItemPrice);
                                }


                                orderItem.ItemId = Convert.ToInt32(Console.ReadLine());

                                Console.WriteLine("Please add quntity number:");

                                orderItem.Quantity = Convert.ToInt32(Console.ReadLine());


                                Inventory inventory = inventoryRepository.Retrieve(orderItem.ItemId);
                                orderItem.Price = inventory.ItemPrice;

                                order.AddnewItem(orderItem);
                            }
                            else if (addItemToOrder == 3)
                            {
                                int itemsindex = 0;
                                Console.WriteLine("Please enter index from the list of item you want to delete?:");
                                foreach (var item in order.OrderItems)
                                {
                                    Inventory inventory = inventoryRepository.Retrieve(item.ItemId);
                                    Console.WriteLine("Index: {1}, Items Name: {0}", inventory.ItemName, itemsindex);
                                    itemsindex = itemsindex + 1;
                                }

                                int itemsindexToDelete = Convert.ToInt32(Console.ReadLine());

                                order.DeleteItem(itemsindexToDelete);
                            }
                            else
                            {
                                addInventory = false;
                            }
                        }
                    }
                    else if (addNewOrder == 2)
                    {
                        Console.WriteLine("Please select Order ID from the list below:");

                        reportGenerator.GenerateOrdersReportByStatus(orders, OrderStatus.Created);
                        reportGenerator.GenerateOrdersReportByStatus(orders, OrderStatus.Aproved);
                        reportGenerator.GenerateOrdersReportByStatus(orders, OrderStatus.Unpaid);
                        reportGenerator.GenerateOrdersReportByStatus(orders, OrderStatus.Paid);
                        reportGenerator.GenerateOrdersReportByStatus(orders, OrderStatus.Delivered);
                        int orderIdTochangeStatus = Convert.ToInt32(Console.ReadLine());
                        foreach (var orderItem in orders)
                        {
                            if (orderItem.OrderId == orderIdTochangeStatus)
                            {
                                orderItem.Status = OrderStatus.Unpaid;
                            }
                        }
                        reportGenerator.GenerateOrdersReportByStatus(orders, OrderStatus.Created);
                        reportGenerator.GenerateOrdersReportByStatus(orders, OrderStatus.Aproved);
                        reportGenerator.GenerateOrdersReportByStatus(orders, OrderStatus.Unpaid);
                        reportGenerator.GenerateOrdersReportByStatus(orders, OrderStatus.Paid);
                        reportGenerator.GenerateOrdersReportByStatus(orders, OrderStatus.Delivered);
                    }
                }
                else if (MainAction == 4)
                {
                    Console.WriteLine("Do you want to generate all clients report? [1] - Yes, [2] - No");

                    int generateClientsReport = Convert.ToInt32(Console.ReadLine());

                    if (generateClientsReport == 1)
                    {
                        Console.WriteLine(reportGenerator.GenerateClientsReport());
                    }

                    Console.WriteLine("Do you want to generate unpaid orders report? [1] - Yes, [2] - No");

                    int unpaidOrdersReport = Convert.ToInt32(Console.ReadLine());

                    if (unpaidOrdersReport == 1)
                    {
                        reportGenerator.GenerateOrdersReportByStatus(orders, OrderStatus.Unpaid);
                    }
                }
                else if (MainAction == 0)
                {
                    Console.WriteLine("Exiting the system....");
                    Console.ReadLine();
                }
                else
                {
                    Console.WriteLine("Undefined input. Please select values from {0, 1, 2, 3, 4}");
                }
            }
        }
Exemple #10
0
 public AdressController(AdressRepository adressRepository, IMapper mapper, IUserService userService)
 {
     AdressRepository = adressRepository;
     Mapper           = mapper;
     UserService      = userService;
 }
Exemple #11
0
        public static void Main(string[] args)
        {
            ProductRepository      productRepository      = new ProductRepository();
            CustomerRepository     customerRepository     = new CustomerRepository();
            AdressRepository       adressRepository       = new AdressRepository();
            OrderRepository        orderRepository        = new OrderRepository();
            ShipperRepository      shipperRepository      = new ShipperRepository();
            OrderProductRepository orderProductRepository = new OrderProductRepository();


            #region address
            var listOfAddresses = new List <Adress>();

            var address2 = new Adress {
                Address = "Trogatan", ZipCode = "60780", City = "Borås", Country = "Sweden"
            };
            var address3 = new Adress {
                Address = "lillabrogatan", ZipCode = "50758", City = "Gothenburg", Country = "Sweden"
            };
            var address4 = new Adress {
                Address = "storgatan", ZipCode = "50758", City = "Gothenburg", Country = "Sweden"
            };
            var address5 = new Adress {
                Address = "Bilvägen", ZipCode = "50670", City = "Gothenburg", Country = "Sweden"
            };
            var address6 = new Adress {
                Address = "trallgatan", ZipCode = "50758", City = "Borås", Country = "Sweden"
            };
            var address7 = new Adress {
                Address = "nordsjövägen", ZipCode = "50890", City = "Gothenburg", Country = "Sweden"
            };
            var address8 = new Adress {
                Address = "Bilvägen", ZipCode = "50758", City = "Gothenburg", Country = "Sweden"
            };

            listOfAddresses.Add(address2);
            listOfAddresses.Add(address3);
            listOfAddresses.Add(address4);
            listOfAddresses.Add(address5);
            listOfAddresses.Add(address6);
            listOfAddresses.Add(address7);
            listOfAddresses.Add(address8);



            var address1 = new Adress
            {
                Address = "Trollvägen",
                ZipCode = "50560",
                City    = "Gothenburg",
                Country = "Sweden",
            };

            adressRepository.CreateAdress(address1);
            adressRepository.CreateAdresses(listOfAddresses);
            adressRepository.DeleteAdressById(8);

            var adresses = adressRepository.GetAllAdresses();
            foreach (var adress in adresses)
            {
                Console.WriteLine(adress.Address + "\t" + adress.ZipCode + "\t" + adress.City + "\t" + adress.Country);
            }

            try
            {
                var addressesByZipCode = adressRepository.GetAdressesByZipCode("50758");
                foreach (var adress in addressesByZipCode)
                {
                    Console.WriteLine(adress.Address + "\t " + adress.ZipCode + "\t " + adress.City + " \t" + adress.Country);
                }
            }
            catch (ArgumentNullException argnull)
            {
                Console.WriteLine("Sorry zipcode dosent exist");
            }

            #endregion


            #region product
            var listOfProducts = new List <Product>();

            var product1 = new Product {
                ProductName = "Hutten Candleholder", Description = "Skultuna CandleHolder", Price = 1200
            };
            var product2 = new Product {
                ProductName = "Pillowcase Rox And Fix ", Description = "Designer Joseph Frank", Price = 900
            };
            var product3 = new Product {
                ProductName = "Pillowcase Hawai", Description = "Designer Joseph Frank", Price = 900
            };
            var product4 = new Product {
                ProductName = "Vase Dagg", Description = "Vase From Svensk Tenn", Price = 2800
            };
            var product5 = new Product {
                ProductName = "Vase Kotte", Description = "Vase From Svensk Tenn", Price = 800
            };

            listOfProducts.Add(product1);
            listOfProducts.Add(product2);
            listOfProducts.Add(product3);
            listOfProducts.Add(product4);
            listOfProducts.Add(product5);

            var product6 = new Product
            {
                ProductName = "Joseph Frank Pillowcase",
                Description = "Svensk Tenn",
                Price       = 1500,
            };

            productRepository.CreateProduct(product6);
            productRepository.CreateProducts(listOfProducts);

            product6.ProductName = "Nisse";
            productRepository.UpdateProduct(product6);

            try
            {
                var product = productRepository.GetProductById(1);
                Console.WriteLine(product.ProductName);
            }
            catch (ArgumentNullException argNull)
            {
                Console.WriteLine("Sorry the product was not found!");
            }
            catch (Exception e)
            {
                Console.WriteLine("Something very bad has happen, contact Emelie!");
            }

            var products = productRepository.GetAllProducts();
            foreach (var product in products)
            {
                Console.WriteLine(product.ProductName + " " + product.Price + "SEK");
            }

            try
            {
                var products1 = productRepository.ProductNameStartWith("ca");
                foreach (var product in products)
                {
                    Console.WriteLine(product.ProductName);
                }
            }
            catch (ArgumentNullException argnull)
            {
                Console.WriteLine("Sorry the product was not found");
            }
            #endregion



            #region customer
            var ListOfCustomers = new List <Customer>();

            var customer1 = new Customer {
                FirstName = "Celine", LastName = "Wanna", PhoneNumber = "0735778990", Email = "*****@*****.**", AdressId = 1
            };
            var customer2 = new Customer {
                FirstName = "Estelle", LastName = "Wanna", PhoneNumber = "0728202020", Email = "*****@*****.**", AdressId = 2
            };

            ListOfCustomers.Add(customer1);
            ListOfCustomers.Add(customer2);

            var customer3 = new Customer
            {
                FirstName   = "Sean",
                LastName    = "Banan",
                PhoneNumber = "072866790",
                Email       = "*****@*****.**",
                AdressId    = 1,
            };

            customerRepository.CreateCustomers(ListOfCustomers);
            customerRepository.CreateCustomer(customer3);

            var customer = customerRepository.GetCustomerById(1);
            Console.WriteLine(customer.Email);


            var customers = customerRepository.GetAllCustomers();

            foreach (var c in customers)
            {
                Console.WriteLine(c.FirstName + " " + c.LastName);
            }
            #endregion

            #region shipper
            var listOfShippers = new List <Shipper>();

            var shipper1 = new Shipper {
                Name = "Svensk Tenn Ab", AdressId = 4
            };
            var shipper2 = new Shipper {
                Name = "Design Online Ab", AdressId = 6
            };
            var shipper3 = new Shipper {
                Name = "Ellos Ab", AdressId = 5
            };

            listOfShippers.Add(shipper1);
            listOfShippers.Add(shipper2);
            listOfShippers.Add(shipper3);

            var shipper4 = new Shipper
            {
                Name     = "Skultuna Ab",
                AdressId = 7,
            };

            shipperRepository.CreateShippers(listOfShippers);
            shipperRepository.CreateShipper(shipper4);
            var shippers = shipperRepository.GetAllShippers();

            foreach (var shipper in shippers)
            {
                Console.WriteLine(shipper.Name);
            }

            try
            {
                var shipperById = shipperRepository.GetShipperById(1);
                Console.WriteLine(shipperById.Name);
            }
            catch (ArgumentNullException argnull)
            {
                Console.WriteLine("Sorry the shipper was not found!");
            }
            catch (Exception e)
            {
                Console.WriteLine("Something very bad has happen, contact Emelie!");
            }
            #endregion

            #region order
            var ListOfOrders = new List <Order>();

            var order1 = new Order {
                OrderDate = DateTime.Now, CustomerId = 1, ShipperId = 2,
            };
            var order2 = new Order {
                OrderDate = DateTime.Now, CustomerId = 2, ShipperId = 1
            };

            ListOfOrders.Add(order1);
            ListOfOrders.Add(order2);

            var order3 = new Order
            {
                OrderDate  = DateTime.Now,
                CustomerId = 3,
                ShipperId  = 3,
            };
            orderRepository.CreateOrders(ListOfOrders);
            orderRepository.CreateOrder(order3);
            var orderAsync = orderRepository.GetOrderById(2).Result;
            #endregion


            #region OrderProduct
            var order = new Order()
            {
                CustomerId = 1,
                OrderDate  = DateTime.Now,
                ShipperId  = 1,
            };

            var product10 = new Product {
                ProductName = "Vase ", Description = "Vase From Svensk Tenn", Price = 2800
            };
            var product11 = new Product {
                ProductName = "Vase design", Description = "Vase From Svensk Tenn", Price = 1000
            };

            listOfProducts.Add(product10);
            listOfProducts.Add(product11);

            orderProductRepository.CreateOrderProduct(order, listOfProducts);
            orderProductRepository.ConnectProductsToOrder(1, new List <int> {
                1, 2, 4
            });
            #endregion


            #region businessLogic
            var businessLogic = new BusinessLogic();
            var city          = "Borås";
            var productId     = 12;

            var customersByProductIdAndCity = businessLogic.GetCustomersByProductIdAndCity(city, productId);
            foreach (var customerByProductIdAndCity in customersByProductIdAndCity)
            {
                Console.WriteLine("Product with id: " + productId + " has been orderd by customer: " + customerByProductIdAndCity.FirstName + " " + customerByProductIdAndCity.LastName + "That lives in " + city);
            }
            #endregion


            Console.WriteLine("Do you want to drop database tables? (Y/N)");
            var userInput = Console.ReadLine();

            if (userInput.Equals("Y", StringComparison.InvariantCultureIgnoreCase))
            {
                Console.WriteLine("Dropping table Orders.");
                var resultOrders = orderRepository.DropOrderTable().Result;
                Console.WriteLine("Order table was dropped:" + resultOrders + "rows where was removed");

                Console.WriteLine("Dropping table Adresses.");
                var resultAdresses = adressRepository.DropAdressTable();
                Console.WriteLine("Adresses table was dropped:" + resultAdresses + "rows where was removed");

                Console.WriteLine("Dropping table Customers.");
                var resultCustomers = customerRepository.DropCustomerTable();
                Console.WriteLine("Customers table was dropped:" + resultCustomers + "rows where was removed");

                Console.WriteLine("Dropping table Products.");
                var resultProducts = productRepository.DropProductTable();
                Console.WriteLine("Products table was dropped:" + resultProducts + "rows where was removed");

                Console.WriteLine("Dropping table Shippers.");
                var result = shipperRepository.DropShipperTable();
                Console.WriteLine("Shippers table was dropped:" + result + "rows where was removed");
            }
        }