private void ProductSaveClick(object sender, RoutedEventArgs e) { string name = this.name.Text; double price = Convert.ToDouble(this.price.Text); TextRange textRange = new TextRange(this.description.Document.ContentStart, this.description.Document.ContentEnd); string description = textRange.Text; Models.ProductCategory category = (Models.ProductCategory)(this.categories.SelectedItem); if (name.Length > 0) { if (this.product == null) { Models.Product product = new Models.Product(); } product.Name = name; product.Category = category; product.Price = price; product.Description = description; if (this.product == null) { manager.create(product); } else { manager.update(product); } this.Close(); } }
private void AddCategory(object sender, RoutedEventArgs e) { string name = this.name.Text; if (name.Length > 0) { Models.ProductCategory category = new Models.ProductCategory(); category.Name = name; manager.create(category); this.Close(); } }