private void InitializeContents() { TB_Name.Text = Product.Name; TB_Price.Text = Product.Price.ToString(); CB_Category.Text = _uow.Repository <Categories>().GetbyId(Product.CategoryId).Name; CB_Availability.IsChecked = Product.Availability; }
private void UpdateTableItems() { if (DG_Info.Items.Count != 0) { DG_Info.ItemsSource = null; } if (CB_ItemstoShow.SelectedItem.ToString() == nameof(Products)) { DG_Info.ItemsSource = _uow.Repository <Products>().GetEntities(); } else { DG_Info.ItemsSource = _uow.Repository <Categories>().GetEntities(); } }
public ProductInfoWindow(Products prdct, GenericUnitofWork unitofWork) { InitializeComponent(); _uow = unitofWork; CB_Category.ItemsSource = _uow.Repository <Categories>().GetEntities(); CB_Category.DisplayMemberPath = nameof(Categories.Name); if (prdct is null) { Product = new Products(); } else { Product = prdct; InitializeContents(); } }