using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Media.Media3D; using System.Windows.Shapes; using wpf_connection3.model; namespace wpf_connection3.Windows { public partial class EditingMaterialWindow : Window { public List MaterialList { get; set; } public int ID { get; set; } public EditingMaterialWindow(int currentProductID) { InitializeComponent(); ID = currentProductID; DataContext = this; MaterialList = Globals.dataProvider.getMaterials(); } private void SaveButton_Click(object sender, RoutedEventArgs e) { try { var material = new ProductMaterial(); material.ProductId = ID; material.Count = Convert.ToInt32(CountTextBox.Text); material.MaterialId = (MaterialTypeComboBox.SelectedItem as model.Material).ID; Globals.dataProvider.addProductMaterial(material); DialogResult = true; } catch (Exception ex) { MessageBox.Show(ex.Message); } } } }