Ejemplo n.º 1
0
 private void btnEdit_click(object obj)
 {
     if (obj is Product product)
     {
         var frm = new AddEditProduct(product);
         frm.ShowDialog();
     }
     else
     {
         MessageController.ShowError("Nie wybrano produktu.");
     }
 }
Ejemplo n.º 2
0
 /// <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());
     }
 }
Ejemplo n.º 3
0
        /// <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());
            }
        }
Ejemplo n.º 4
0
        private void btnAdd_click(object obj)
        {
            var frm = new AddEditProduct();

            frm.ShowDialog();
        }