private void btnEdit_click(object obj) { if (obj is Product product) { var frm = new AddEditProduct(product); frm.ShowDialog(); } else { MessageController.ShowError("Nie wybrano produktu."); } }
/// <summary> /// Method for executing add Command, opens view for adding new product /// </summary> private void AddCommandExecute() { try { AddEditProduct addView = new AddEditProduct(); addView.ShowDialog(); if ((addView.DataContext as AddEditProductViewModel).IsUpdateProduct == true) { ProductList = service.GetAllProducts().ToList(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
/// <summary> /// Executes the edit command /// </summary> public void EditCommandExecute() { try { if (Product != null) { AddEditProduct editProduct = new AddEditProduct(Product); editProduct.ShowDialog(); if ((editProduct.DataContext as AddEditProductViewModel).IsUpdateProduct == true) { ProductList = service.GetAllProducts().ToList(); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void btnAdd_click(object obj) { var frm = new AddEditProduct(); frm.ShowDialog(); }