I'm working on a e-commerce site and using nhibernate code to add or edit new products.
When i add new product the SaveOrUpdate(newProduct) function seems to work fine, however, if i try to update existing product, the function doesn't work
Below is my code:
public void btnSave_Click(object sender, EventArgs e)
{
Product newProduct;
if (this.prID.Value == "0")
newProduct = new Product();
else
newProduct = _daoFactory.GetProductDao().GetById(Convert.ToInt32(this.prID.Value), true);
newProduct.Name = Convert.ToString(this.txtName.Text);
newProduct.Description = Convert.ToString(this.txtDescription.Text);
newProduct.Summary = Convert.ToString(this.FreeTextBox1.Text);
newProduct.ProductId = Convert.ToInt32(0);
_daoFactory.GetProductDao().SaveOrUpdate(newProduct);
Response.Redirect("products.aspx");
}
Any kind of help will be appreciated.
Thanks in Advance!
Arshya
|