public CustomerOrdersPresenter(ICustomerOrders customerOrdersView, OrderDetailsPresenter orderDetailsPresenter)
        {
            view             = customerOrdersView;
            detailsPresenter = orderDetailsPresenter;

            view.OrderSelected += View_OrderSelected;
            view.OrderDeleted  += View_OrderDeleted;

            using (var db = new everyloopNETContext())
            {
                if (db.Database.CanConnect())
                {
                    var products = db.Products.OrderBy(p => p.ProductName).ToList();

                    detailsPresenter.LoadProducts(products);

                    view.Customers = db.Customers
                                     .Include(customer => customer.Orders)
                                     .ThenInclude(order => order.OrderDetails)
                                     .ThenInclude(details => details.Product)
                                     .ToList();
                }
                else
                {
                    Debug.WriteLine("Connection failed!");
                }
            }
        }
        private void View_OrderDetailsUpdated(object sender, OrderDetailsEventArgs e)
        {
            Debug.WriteLine($"Updated details: {e.details.Id}");

            using (var db = new everyloopNETContext())
            {
                if (db.Database.CanConnect())
                {
                    var details = db.OrderDetails.FirstOrDefault(d => d.Id == e.details.Id);

                    if (details != null)
                    {
                        details.ProductId = e.details.Product.Id;
                        details.UnitPrice = e.details.Product.UnitPrice;
                        details.Quantity  = e.details.Quantity;
                    }

                    var trackedObjects = db.ChangeTracker.Entries();

                    db.SaveChanges();
                }
            }
        }