public IActionResult Put(long id, [FromBody] Product product) { ProductBO productBO; ObjectResult response; try { _log.LogInformation($"Starting Put( {id}, '{JsonConvert.SerializeObject(product, Formatting.None)}')"); productBO = new ProductBO(_loggerFactory, _config); product.ID = id; product = productBO.Update(product); response = Ok(product); _log.LogInformation($"Finishing Put( {id} )"); } catch (Exception ex) { _log.LogError(ex.Message); response = StatusCode(500, ex.Message); } return(response); }
private void btnEditInput_Click(object sender, EventArgs e) { if (txtAllProductInputName.Text != string.Empty && txtAllInputPrice.Text != string.Empty && txtAllInputPrice.Text != "0") { productIP = new Data.ProductIP(); productIP.Name = txtAllProductInputName.Text; productIP.Price = int.Parse(txtAllInputPrice.Text); productIP.ID = productIBO.GetIDByName(txtAllProductInputName.Text); productIBO.Update(productIP); MessageBox.Show("Hệ thống cập nhật thành công"); loadInformation(); } else { MessageBox.Show("Hệ thống cập nhật thất bại"); } }
/// <summary> /// Updates a product. /// </summary> /// <param name="product">The product that will be updated</param> /// <returns>Returns a bool indicating if the operation was completed as expected or not.</returns> public bool Update(ProductDataContract product) { return(productBO.Update(product)); }