public EditControl(producttable ent)
 {
     InitializeComponent();
     this.id                = ent.id;
     NameField.Text         = ent.Name;
     ArticleField.Text      = ent.Article;
     DescriptionField.Text  = ent.Description;
     ManufacturerField.Text = ent.Manufacturer;
     UPPField.Text          = Convert.ToString(ent.UnitPerPrice);
     UnitTypeField.Text     = ent.UnitType;
     PriceField.Text        = Convert.ToString(ent.Price);
 }
        private void SaveToDatabase(object sender, RoutedEventArgs e)
        {
            String name         = NameField.Text;
            String article      = ArticleField.Text;
            String descr        = DescriptionField.Text;
            String manufacturer = ManufacturerField.Text;
            String UTP          = UnitTypeField.Text;
            float  UPP          = Convert.ToSingle(UPPField.Text);
            float  price        = Convert.ToSingle(PriceField.Text);

            producttable prod = MainWindow.Database.producttable.FirstOrDefault(f => f.id == id);

            prod.Name         = name;
            prod.Article      = article;
            prod.Description  = descr;
            prod.Manufacturer = manufacturer;
            prod.Price        = price;
            prod.UnitPerPrice = UPP;
            prod.UnitType     = UTP;

            MainWindow.Database.SaveChanges();

            ViewControl.self.UpdateBtnClick(null, null);
        }