本文整理汇总了C#中ProductModel.UpdateProduct方法的典型用法代码示例。如果您正苦于以下问题:C# ProductModel.UpdateProduct方法的具体用法?C# ProductModel.UpdateProduct怎么用?C# ProductModel.UpdateProduct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProductModel
的用法示例。
在下文中一共展示了ProductModel.UpdateProduct方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: btnSubmit_Click
protected void btnSubmit_Click(object sender, EventArgs e)
{
ProductModel productModel = new ProductModel();
Product product = CreateProduct();
if (!String.IsNullOrWhiteSpace(Request.QueryString["id"]))
{
int id = Convert.ToInt32(Request.QueryString["id"]);
lblResult.Text = productModel.UpdateProduct(id, product);
}
else
{
lblResult.Text = productModel.InsertProduct(product);
}
}
示例2: Button1_Click
protected void Button1_Click(object sender, EventArgs e)
{
ProductModel productModel = new ProductModel();
Product product = CreateProduct();
//check if the url contains an id parameter
if (!String.IsNullOrWhiteSpace(Request.QueryString["id"]))
{
//ID exits - update existing row
int id = Convert.ToInt32(Request.QueryString["id"]);
lblResult.Text = productModel.UpdateProduct(id, product);
}
else
{
//ID does not exist - create new row
lblResult.Text = productModel.InsertProduct(product);
}
}
示例3: btnSubmit_Click
protected void btnSubmit_Click(object sender, EventArgs e)
{
ProductModel productModel = new ProductModel();
Product product = CreateProduct();
if(!String.IsNullOrWhiteSpace(Request.QueryString["id"]))
{
//ID exists then upadte existing row
int id = Convert.ToInt32(Request.QueryString["id"]);
lblResult.Text = productModel.UpdateProduct(id, product);
}
else
{
//ID dose not xist then creat a new row
lblResult.Text = productModel.InsertProduct(product);
}
Response.Redirect("~/Pages/Management/ManageWebsite.aspx", false);
}
示例4: submitButton_Click
protected void submitButton_Click(object sender, EventArgs e)
{
//get the productModle.cs function
ProductModel pm = new ProductModel();
//call the createProduct() method
Product product = createProduct();
//add new product
if (String.IsNullOrWhiteSpace(Request.QueryString["id"]))
{
//display the resultmessage and call the InSetProduct method from pm which is the productModle.cs
productMessageLabel.Text = pm.InSetProduct(product);
}
//modify existing model update
else
{
//get the existing product id
int id = Convert.ToInt32(Request.QueryString["id"]);
//use update method
productMessageLabel.Text = pm.UpdateProduct(id, product);
}
}