private void NewProduct()
        {
            Product        product        = new Product();
            frmEditProduct frmEditProduct = new frmEditProduct(product);

            if (frmEditProduct.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Supplier supplier = GetSelectedSupplier();
                product.SupplierID = supplier.SupplierID;
                using (var db = new StoreManagerContext())
                {
                    db.Products.Add(product);
                    db.SaveChanges();
                }
            }
        }
        private void EditProduct()
        {
            Product        product        = GetSelectedProduct();
            frmEditProduct frmEditProduct = new frmEditProduct(product);

            if (frmEditProduct.ShowDialog() == DialogResult.OK)
            {
                using (var db = new StoreManagerContext())
                {
                    Product originalProduct = (from p in db.Products
                                               where p.ProductID == product.ProductID
                                               select p).Single();

                    CloneProduct(product, originalProduct);
                    db.SaveChanges();
                }
            }
        }
        private void EditProduct()
        {
            Product product = GetSelectedProduct();
            frmEditProduct frmEditProduct = new frmEditProduct(product);
            if (frmEditProduct.ShowDialog() == DialogResult.OK)
            {
                using (var db = new StoreManagerContext())
                {
                    Product originalProduct = (from p in db.Products
                                               where p.ProductID == product.ProductID
                                               select p).Single();

                    CloneProduct(product, originalProduct);
                    db.SaveChanges();
                }
            }
        }
 private void NewProduct()
 {
     Product product = new Product();
     frmEditProduct frmEditProduct = new frmEditProduct(product);
     if (frmEditProduct.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         Supplier supplier = GetSelectedSupplier();
         product.SupplierID = supplier.SupplierID;
         using (var db = new StoreManagerContext())
         {
             db.Products.Add(product);
             db.SaveChanges();
         }
     }
 }