public IActionResult UpdateProduct([FromBody] MvProductUpdate product) { try { var updated = _productService.UpdateProduct(product); if (!updated) { return(BadRequest()); } return(Ok()); } catch (Exception e) { throw e; } }
public bool UpdateProduct(MvProductUpdate productUpdate) { using (var connection = _dataAccess.GetConnection()) { var jsonNew = JsonConvert.SerializeObject(productUpdate); var command = connection.CreateCommand(); command.CommandType = CommandType.StoredProcedure; command.CommandText = "SpProductProductRateUpdTsk"; command.Parameters.Add("@json", SqlDbType.NChar).Value = jsonNew; command.CommandTimeout = _commandTimeout; int rows = command.ExecuteNonQuery(); if (rows > 0) { return(true); } return(false); } }