LINQ delete
using (POHDataContext pos = new POHDataContext())
{
ProductTable newProduct = pos.ProductTables.SingleOrDefault(p => p.ProductId == int.Parse(txtId.Text));
pos.ProductTables.DeleteOnSubmit(newProduct);
pos.SubmitChanges();
}
GetProducts();
LINQ edit
using (POHDataContext pos = new POHDataContext())
{
ProductTable newProduct = pos.ProductTables.SingleOrDefault(p => p.ProductId == int.Parse(txtId.Text));
newProduct.ProductName = txtProductName.Text;
newProduct.ProductPrice = decimal.Parse(txtProductPrice.Text);
newProduct.Stock = int.Parse(txtStock.Text);
pos.SubmitChanges();
}
GetProducts();
No comments:
Post a Comment