コード例 #1
0
 private void btn_Update_Click(object sender, EventArgs e)
 {
     try
     {
         Product product = new Product()
         {
             ID          = Int32.Parse(lbl_ID.Text),
             ProductName = txt_Name.Text,
             Quantity    = Int32.Parse(txt_Quantity.Text),
             Price       = Decimal.Parse(txt_Price.Text)
         };
         _productRepo.UpdateProduct(product);
         LoadProducts();
     }
     catch (Exception)
     {
         MessageBox.Show("Input not valid. Please try again");
     }
     finally
     {
         clearSelection();
     }
 }
コード例 #2
0
 /// <summary>
 /// Update a product in the data source
 /// </summary>
 /// <param name="product">Product to update</param>
 public void UpdateProduct(Product product)
 {
     productDataAccess.UpdateProduct(product);
 }
コード例 #3
0
 public void UpdateProduct(Product product)
 {
     _productData.UpdateProduct(product);
 }
 public Task <bool> UpdateProduct(ProductItem product)
 {
     // Perform business logic here
     return(_productDataAccess.UpdateProduct(product));
 }